Types
Here is a list of the built-in immutable types:
Number
A number wrapper to support serialisation of -0, NaN and ±Infinity (rarely needed).
Examples:
new M.Number(0)
M.Number.of(5)
M.Number.of(NaN)
M.Number.of(-Infinity)Date
Much like a JavaScript date, but immutable.
Examples:
new M.Date()
new M.Date(new Date(1978, 11, 6))
M.Date.of()
M.Date.of(new Date(1978, 11, 6))Enum
Simple enumerated values with optional associated data.
Examples:
Map
Ordered map with arbitrary keys and values.
Examples:
EnumMap
Ordered map with enum keys and arbitrary values.
Examples:
StringMap
Ordered map with string keys and arbitrary values.
Examples:
List
Ordered indexed collection, implemented with plain arrays, but immutable.
Examples:
Set
Ordered collection with no repeated values.
Maybe
It helps with optional/nullable fields. See Optional / null values: Maybes for more details.
Last updated