Module
Data.TaggedSum
- Package
- purescript-tagged-sum
- Repository
- lumihq/purescript-tagged-sum
A variant data type, based on rows, but unlike
purescript-variant
, this one uses a representation
which is compatible with Aeson, so that we can
use the data we get from the server directly.
Re-exports from Data.TaggedSum.Internal
#match Source
match :: forall x rl r. RowToList r rl => AllVoid rl => TaggedSum r -> x
Pattern match an empty variant, once all possible tags have
been handled using case_
.
For example:
x :: TaggedSum (foo :: Int, bar :: Char)
x = review (tag (SProxy :: SProxy "foo")) 42
f :: TaggedSum (foo :: Int, bar :: Char) -> String
f = match
# case_ (tag (SProxy :: SProxy "foo")) show
# case_ (tag (SProxy :: SProxy "bar")) show
> f x
"42"