Pure generation of unique identifiers in Elm.
The type of an identifier. Identifiers are integers, but this is an opaque
type so that we cannot introduce them by accident. Equality and toString are
supported on Id
values.
A computation that consumes unique identifiers and produces a value of type
a
.
run : Unique a -> a
Run a computation that consumes unique IDs. Within one invocation of run
,
the generated Id
values are guaranteed to be unique. However, multiple
invocations of run
will generate conflicting Id
s.
return : a -> Unique a
Return a constant value without consuming any IDs.
unique : Unique Id
Generate a unique ID.
andThen : (a -> Unique b) -> Unique a -> Unique b
Chain together two Unique
computations.
map : (a -> b) -> Unique a -> Unique b
Apply a function to the result of a Unique
computation.
map2 : (a -> b -> c) -> Unique a -> Unique b -> Unique c
Apply a function to the result of two Unique
computations.
map3 : (a -> b -> c -> d) -> Unique a -> Unique b -> Unique c -> Unique d
Apply a function to the result of three Unique
computations.
replicate : Basics.Int -> Unique a -> Unique (List a)
Repeatedly invoke a Unique
computation, generating a list of results.
sequence : List (Unique a) -> Unique (List a)
Execute a list of Unique
computations in order.