Pudu programming language
Menu
API reference

Std.EnumMap.EnumMap

1 declaration

type

EnumMap

This declaration introduces a public type.

What it does

A map over a fixed set of keys, where every key has a value.

The days of a week, the variants of a status, the levels of a log: the keys

are known when the program is written, and every one of them has an entry.

Asking an ordinary Map for one still answers Option[V], so the caller

unwraps a value they already knew was there, and picks a fallback that can

never be used — a decision they had to make and a reader has to read past.

This removes that, in the way NonEmpty removes the Option from first:

by making the map total when it is built. get answers V. The cost is

paid once, at the boundary, where the caller says which keys exist and what

each one starts as.

Keys are held in the order the domain names them, not sorted, because a

domain is usually written in an order that means something — Monday first,

Debug below Error — and sorting it would replace the author's order with the

spelling of the names.

Read the signature

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

Back to Std.EnumMapSearch related declarations