Module

Data.Functor.Polynomial.Variant

Package
purescript-dissect
Repository
PureFunctor/purescript-dissect

This module provides a VariantF-like type specialized to contain polynomial functors and to be dissectible itself. Likewise, operations such as inj, case_, and on are also provided.

See also: https://pursuit.purescript.org/packages/purescript-variant/

#VariantF Source

data VariantF :: forall k. Row (k -> Type) -> k -> Typedata VariantF r a

Instances

#inj Source

inj :: forall n p q t r a. Functor p => Bifunctor q => Cons n p t r => IsSymbol n => Dissect p q => Plug p q => Proxy n -> p a -> VariantF r a

Inject a polynomial functor to a variant given a label.

#case_ Source

case_ :: forall a b. VariantF () a -> b

Combinator for pattern matching.

#on Source

on :: forall n r s p a b. Cons n p s r => IsSymbol n => Proxy n -> (p a -> b) -> (VariantF s a -> b) -> VariantF r a -> b

Attempt to read a variant given a label, defaulting to a failure branch with the failing label removed.

#VariantF_2 Source

data VariantF_2 :: Row (Type -> Type -> Type) -> Type -> Type -> Typedata VariantF_2 r a b

Instances

#inj_2 Source

inj_2 :: forall n p q t r a b. Functor p => Bifunctor q => Cons n q t r => IsSymbol n => Dissect p q => Plug p q => Proxy n -> q a b -> VariantF_2 r a b

#DissectRow Source

class DissectRow :: RowList (Type -> Type) -> RowList (Type -> Type -> Type) -> Constraintclass DissectRow r s | r -> s

Instances

#PlugRow Source

class PlugRow :: RowList (Type -> Type) -> RowList (Type -> Type -> Type) -> Constraintclass PlugRow r s | r -> s

Instances