Module

Dissect.Record

Package
purescript-dissect
Repository
PureFunctor/purescript-dissect

Record-based product types, RecordF and RecordB which form a Dissect instance. Useful for defining data types algebraically while also having decent runtime performance and convenient pattern matching syntax.

#Instances Source

type Instances = { bimap :: forall q a b c d. (a -> b) -> (c -> d) -> q a c -> q b d, init :: forall p q c j. p j -> Result p q c j, map :: forall p a b. (a -> b) -> (p a -> p b), next :: forall p q c j. q c j -> c -> Result p q c j }

#RecordF Source

data RecordF :: Row Type -> Type -> Typedata RecordF r a

A record-based product type of functors applied to a.

Instances

#RecordFRep Source

newtype RecordFRep a

The internal representation for RecordF.

Constructors

#mapRecordF Source

mapRecordF :: forall r a b. (a -> b) -> (RecordF r a) -> (RecordF r b)

#RecordB Source

data RecordB :: Row Type -> Type -> Type -> Typedata RecordB r a b

A record-based product type of bifunctors applied to a and b.

Instances

#RecordBRep Source

newtype RecordBRep a b

Constructors

#bimapRecordF Source

bimapRecordF :: forall r a b c d. (a -> c) -> (b -> d) -> (RecordB r a b -> RecordB r c d)

#initRecordF Source

initRecordF :: forall r c j. RecordF r j -> Result (RecordF r) (RecordB r) c j

#nextRecordF Source

nextRecordF :: forall r c j. RecordB r c j -> c -> Result (RecordF r) (RecordB r) c j

#Pair Source

data Pair :: (Type -> Type) -> (Type -> Type -> Type) -> Typedata Pair t0 t1

A pair of a Functor and a Bifunctor.

Instances

  • (ToAux future argument farFuture, Cons name (functor argument) farFuture farFutureWithElement) => ToAux (Cons name (Pair functor bifunctor) future) argument farFutureWithElement

#FromAux Source

class FromAux :: RowList Type -> Type -> Row Type -> Constraintclass FromAux rl a r | rl -> a r where

Members

Instances

#From Source

class From :: Row Type -> Type -> Row Type -> Constraintclass From r a r' | r -> a r' where

Converts a Record into a RecordF.

Members

Instances

#ToAux Source

class ToAux :: RowList Type -> Type -> Row Type -> Constraintclass ToAux rl a r | rl a -> r

Instances

  • ToAux Nil a ()
  • (ToAux future argument farFuture, Cons name (functor argument) farFuture farFutureWithElement) => ToAux (Cons name (Pair functor bifunctor) future) argument farFutureWithElement

#To Source

class To :: Row Type -> Type -> Row Type -> Constraintclass To r a r' | r a -> r' where

Converts a RecordF into a Record.

Members

Instances