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