Module

Record.Studio.MapKind

Package
purescript-record-studio
Repository
rowtype-yoga/purescript-record-studio

#MapRecordKind Source

data MapRecordKind :: forall k. (k -> Type) -> (k -> Type) -> Typedata MapRecordKind f g

Constructors

Instances

#mapRecordKind Source

mapRecordKind :: forall f g rin rout. HFoldlWithIndex (MapRecordKind 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
mapRecordKind { a : { b : { c : { d: Right 10, e : Left "hello" }, f : Right true }
-- Just { a : { b : { c : { d: Just 10, e : Nothing }, f : Just true }