A module that allows you to "tag" a value.
Explicitly changes the tag of a value.
Forces you to recognize that the value is being interpreted differently from before.
We can remove the tag when we're done making additional compile-time assertions.
Useful for applying a function on a Tagged value.
foo =
map String.toUpper aTaggedStringUseful for building more useful functions:
map f =
ap (Tagged f)
map2 f x =
ap (map f x)
map3 f x y =
ap (map2 f x y)An alternative to ap:
foo =
map2 Array.get index arrUseful for composing functions together in a pipeline:
foo =
Tagged Array.set
|> andMap index
|> andMap value
|> andMap arrUseful for restricting the tag created in a polymorphic function.
Useful for restricting the tag created in a polymorphic function.
A Type that pairs a
valuewith atag.The
tagis ignored at runtime as evidenced by the only value constructor: