Module

Morello.Morello.Record

Package
purescript-morello
Repository
sigma-andex/purescript-morello

#HSequenceRec Source

data HSequenceRec (f :: Type -> Type)

Constructors

Instances

#hsequenceRec Source

hsequenceRec :: forall f rin rout. Applicative f => HFoldlWithIndex (HSequenceRec f) (f (Builder (Record ()) (Record ()))) (Record rin) (f (Builder (Record ()) (Record rout))) => Record rin -> f (Record rout)

Recursively sequence a record. E.g. hsequenceRec { a : { b : { c : { d: Just 10, e : Just "hello" }, f : Just true } == Just { a : { b : { c : { d: 10, e : "hello" }, f : true }

#HMapRec Source

data HMapRec a b

Constructors

Instances

#hmapRec Source

hmapRec :: forall a b rin rout. HFoldlWithIndex (HMapRec a b) (Builder (Record ()) (Record ())) (Record rin) (Builder (Record ()) (Record rout)) => (a -> b) -> Record rin -> Record rout

Recursively maps a record using a function f. E.g. let f :: Int -> String f i = show (i + 1) hmapRec f { a : { b : 10, c : { d: 20, e : Just "hello" }}, f : 30 } == { a : { b : "11", c : { d: "21", e : Just "hello" }, f : "31" }

#HMapKRec Source

data HMapKRec f g

Constructors

Instances

#hmapKRec Source

hmapKRec :: forall f g rin rout. HFoldlWithIndex (HMapKRec f g) (Builder (Record ()) (Record ())) (Record rin) (Builder (Record ()) (Record rout)) => (f ~> g) -> Record rin -> Record rout

Recursively mapK a record using a natural transformation. E.g. let nt :: Either String ~> Maybe nt = hush hmapKRec { a : { b : { c : { d: Right 10, e : Left "hello" }, f : Right true } == Just { a : { b : { c : { d: Just 10, e : Nothing }, f : Just true }