Module
Record.Studio.MapKind
- Package
- purescript-heterogeneous-extrablatt
- Repository
- sigma-andex/purescript-heterogeneous-extrablatt
#MapRecordKind Source
data MapRecordKind :: forall k. (k -> Type) -> (k -> Type) -> Type
data MapRecordKind f g
Constructors
MapRecordKind (f ~> g)
Instances
(IsSymbol sym, Lacks sym rb, Cons sym (g a) rb rc) => FoldingWithIndex (MapRecordKind f g) (Proxy sym) (Builder (Record ra) (Record rb)) (f a) (Builder (Record ra) (Record rc))
(IsSymbol sym, Lacks sym rb, RowToList x xRL, Cons sym (Record y) rb rc, FoldlRecord (MapRecordKind f g) (Builder (Record ()) (Record ())) xRL x (Builder (Record ()) (Record y))) => FoldingWithIndex (MapRecordKind f g) (Proxy sym) (Builder (Record ra) (Record rb)) (Record x) (Builder (Record ra) (Record rc))
(IsSymbol sym, Lacks sym rb, Cons sym x rb rc) => FoldingWithIndex (MapRecordKind f g) (Proxy sym) (Builder (Record ra) (Record rb)) x (Builder (Record ra) (Record rc))
#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 }