Module
Data.TaggedSum.Internal
- Package
- purescript-tagged-sum
- Repository
- lumihq/purescript-tagged-sum
#TaggedSum Source
#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"
#DecodeHelper Source
class DecodeHelper (r :: Row Type) (rl :: RowList) | rl -> r where
Members
Instances
DecodeHelper () Nil
(IsSymbol l, DecodeHelper r_ rl, Decode a, Cons l a r_ r) => DecodeHelper r (Cons l a rl)
#EncodeHelper Source
class EncodeHelper (r :: Row Type) (rl :: RowList) | rl -> r where
Members
encodeHelper :: RLProxy rl -> TaggedSum r -> { contents :: Foreign, tag :: String }
Instances
(RowToList r rl, AllVoid rl) => EncodeHelper r Nil
(IsSymbol l, EncodeHelper r__ rl, Encode a, Cons l a r_ r, Cons l Void r_ r__) => EncodeHelper r (Cons l a rl)