Module
Data.Functor.Variant
- Package
- purescript-variant
- Repository
- natefaubion/purescript-variant
#case_ Source
case_ :: forall b a. VariantF () a -> b
Combinator for exhaustive pattern matching.
caseFn :: VariantF (foo :: FProxy Maybe, bar :: FProxy (Tuple String), baz :: FProxy (Either String)) Int -> String
caseFn = case_
# on (SProxy :: SProxy "foo") (\foo -> "Foo: " <> maybe "nothing" show foo)
# on (SProxy :: SProxy "bar") (\bar -> "Bar: " <> show (snd bar))
# on (SProxy :: SProxy "baz") (\baz -> "Baz: " <> either id show baz)
#default Source
default :: forall r b a. a -> VariantF r b -> a
Combinator for partial matching with a default value in case of failure.
caseFn :: forall r. VariantF (foo :: FProxy Maybe, bar :: FProxy (Tuple String) | r) Int -> String
caseFn = default "No match"
# on (SProxy :: SProxy "foo") (\foo -> "Foo: " <> maybe "nothing" show foo)
# on (SProxy :: SProxy "bar") (\bar -> "Bar: " <> show (snd bar))
Re-exports from Data.Symbol
- Modules
- Data.
Functor. Variant - Data.
Variant