Module
Dissect.Variant
- Package
- purescript-dissect
- Repository
- PureFunctor/purescript-dissect
Row-based sum types, VariantF
and VariantB
, which form a Dissect
instance. Useful for defining data types algebraically while also having
decent runtime performance and convenient pattern matching syntax.
#VariantFRep Source
newtype VariantFRep :: (Type -> Type) -> (Type -> Type -> Type) -> Type -> Type
newtype VariantFRep p q a
The internal representation for VariantF
.
Constructors
VariantFRep { bimap :: forall w x y z. (w -> x) -> (y -> z) -> q w y -> q x z, init :: forall c j. p j -> Result p q c j, map :: forall x y. (x -> y) -> (p x -> p y), next :: forall c j. q c j -> c -> Result p q c j, tag :: String, value :: p a }
#VariantBRep Source
newtype VariantBRep :: (Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type
newtype VariantBRep p q a b
The internal representation for VariantB
.
Constructors
VariantBRep { bimap :: forall w x y z. (w -> x) -> (y -> z) -> q w y -> q x z, init :: forall c j. p j -> Result p q c j, map :: forall x y. (x -> y) -> (p x -> p y), next :: forall c j. q c j -> c -> Result p q c j, tag :: String, value :: q a b }
#VariantFMatchCases Source
class VariantFMatchCases :: RowList Type -> Row Type -> Type -> Type -> Constraint
class VariantFMatchCases rl vo a b | rl -> vo a b
Instances
(VariantFMatchCases rl vo' a b, Cons sym (Pair p q) vo' vo, TypeEquals k (p a -> b)) => VariantFMatchCases (Cons sym k rl) vo a b
VariantFMatchCases Nil () a b