Pudu programming language
Menu
API reference

Std.NonEmpty.NonEmpty

1 declaration

type

NonEmpty

This declaration introduces a public type.

What it does

A sequence that has at least one element, and says so in its type.

List.first and List.maximum answer Option because an array may be

empty and there is nothing honest to return when it is. A caller that

already knows its data is not empty pays for that everywhere: an Option

unwrapped at each step, or a fallback invented for a case that cannot

happen. Stating it once, here, removes the question from every call after.

Read the signature

  • This declaration has no value signature because it introduces a type or trait.

Back to Std.NonEmptySearch related declarations