Module

Record.Studio

Package
purescript-heterogeneous-extrablatt
Repository
sigma-andex/purescript-heterogeneous-extrablatt

Re-exports from Record.Studio.Keys

#Keys Source

class Keys :: Row Type -> Constraintclass Keys (r :: Row Type)  where

Members

Instances

#recordKeys Source

recordKeys :: forall r. Keys r => Record r -> Array String

Re-exports from Record.Studio.Map

#MapRecord Source

data MapRecord a b

Constructors

Instances

#mapRecord Source

mapRecord :: forall a b rin rout. HFoldlWithIndex (MapRecord 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.

let
  f :: Int -> String
  f i = show (i + 1)
mapRecord  f { a : { b : 10, c : { d: 20, e : Just "hello" }}, f : 30 }
-- { a : { b : "11", c : { d: "21", e : Just "hello" }, f : "31" }

Re-exports from Record.Studio.MapKind

#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 }

Re-exports from Record.Studio.Merge

#mergeFlipped Source

mergeFlipped :: forall r1 r2 r3 r4. Union r1 r2 r3 => Nub r3 r4 => Record r2 -> Record r1 -> Record r4

Like merge but with its arguments flipped. I.e. merges two records with the seconds record's labels taking precedence in the case of overlaps.

For example:

mergeFlipped { x: 1, y: "y" } { y: 2, z: true }
 = { x: 1, y: 2, z: true }

#(//) Source

Operator alias for Record.Studio.Merge.mergeFlipped (right-associative / precedence 1)

record1 // record2 is equivalent to JS's { ...record1, ...record2 }

Re-exports from Record.Studio.SameKeys

#SameKeys Source

class SameKeys :: Row Type -> Row Type -> Constraintclass SameKeys (r1 :: Row Type) (r2 :: Row Type) 

Instances

Re-exports from Record.Studio.Sequence

#SequenceRecord Source

data SequenceRecord :: (Type -> Type) -> Typedata SequenceRecord (f :: Type -> Type)

Constructors

Instances

#sequenceRecord Source

sequenceRecord :: forall f rin rout. Applicative f => HFoldlWithIndex (SequenceRecord f) (f (Builder (Record ()) (Record ()))) (Record rin) (f (Builder (Record ()) (Record rout))) => Record rin -> f (Record rout)

Recursively sequence a record. E.g.

sequenceRecord { a : { b : { c : { d: Just 10, e : Just "hello" }, f : Just true }
-- Just { a : { b : { c : { d: 10, e : "hello" }, f : true }

Re-exports from Record.Studio.Shrink

#shrink Source

shrink :: forall a b r. Union b r a => Keys b => Record a -> Record b