Module

Record

#get

get :: forall r r' l a. IsSymbol l => Cons l a r' r => SProxy l -> {  | r } -> a

Get a property for a label which is specified using a value-level proxy for a type-level string.

For example:

get (SProxy :: SProxy "x") :: forall r a. { x :: a | r } -> a

#set

set :: forall r1 r2 r l a b. IsSymbol l => Cons l a r r1 => Cons l b r r2 => SProxy l -> b -> {  | r1 } -> {  | r2 }

Set a property for a label which is specified using a value-level proxy for a type-level string.

For example:

set (SProxy :: SProxy "x")
  :: forall r a b. a -> { x :: b | r } -> { x :: a | r }

#modify

modify :: forall r1 r2 r l a b. IsSymbol l => Cons l a r r1 => Cons l b r r2 => SProxy l -> (a -> b) -> {  | r1 } -> {  | r2 }

Modify a property for a label which is specified using a value-level proxy for a type-level string.

For example:

modify (SProxy :: SProxy "x")
  :: forall r a b. (a -> b) -> { x :: a | r } -> { x :: b | r }

#insert

insert :: forall r1 r2 l a. IsSymbol l => Lacks l r1 => Cons l a r1 r2 => SProxy l -> a -> {  | r1 } -> {  | r2 }

Insert a new property for a label which is specified using a value-level proxy for a type-level string.

For example:

insert (SProxy :: SProxy "x")
  :: forall r a. Lacks "x" r => a -> { | r } -> { x :: a | r }

#delete

delete :: forall r1 r2 l a. IsSymbol l => Lacks l r1 => Cons l a r1 r2 => SProxy l -> {  | r2 } -> {  | r1 }

Delete a property for a label which is specified using a value-level proxy for a type-level string.

Note that the type of the resulting row must lack the specified property. Since duplicate labels are allowed, this is checked with a type class constraint.

For example:

delete (SProxy :: SProxy "x")
  :: forall r a. Lacks "x" r => { x :: a | r } -> { | r }

#rename

rename :: forall prev next ty input inter output. IsSymbol prev => IsSymbol next => Cons prev ty inter input => Lacks prev inter => Cons next ty inter output => Lacks next inter => SProxy prev -> SProxy next -> {  | input } -> {  | output }

Rename a property for a label which is specified using a value-level proxy for a type-level string.

Note that the type of the resulting row must lack the specified property. Since duplicate labels are allowed, this is checked with a type class constraint.

For example:

rename (SProxy :: SProxy "x") (SProxy :: SProxy "y")
  :: forall a r. Lacks "x" r => Lacks "y" r => { x :: a | r} -> { y :: a | r}

#equal

equal :: forall r rs. RowToList r rs => EqualFields rs r => {  | r } -> {  | r } -> Boolean

Check two records of the same type for equality.

#merge

merge :: forall r1 r2 r3 r4. Union r1 r2 r3 => Nub r3 r4 => {  | r1 } -> {  | r2 } -> {  | r4 }

Merges two records with the first record's labels taking precedence in the case of overlaps.

For example:

merge { x: 1, y: "y" } { y: 2, z: true }
 :: { x :: Int, y :: String, z :: Boolean }

#union

union :: forall r1 r2 r3. Union r1 r2 r3 => {  | r1 } -> {  | r2 } -> {  | r3 }

Merges two records with the first record's labels taking precedence in the case of overlaps. Unlike merge, this does not remove duplicate labels from the resulting record type. This can result in better inference for some pipelines, deferring the need for a Nub constraint.

For example:

union { x: 1, y: "y" } { y: 2, z: true }
 :: { x :: Int, y :: String, y :: Int, z :: Boolean }

#disjointUnion

disjointUnion :: forall r1 r2 r3. Union r1 r2 r3 => Nub r3 r3 => {  | r1 } -> {  | r2 } -> {  | r3 }

Merges two records where no labels overlap. This restriction exhibits better inference than merge when the resulting record type is known, but one argument is not.

For example, hole ?help is inferred to have type { b :: Int } here:

disjoinUnion { a: 5 } ?help :: { a :: Int, b :: Int }

#nub

nub :: forall r1 r2. Nub r1 r2 => {  | r1 } -> {  | r2 }

A coercion which removes duplicate labels from a record's type.

#EqualFields

class EqualFields (rs :: RowList) (row :: # Type) | rs -> row where

Members

Instances

Modules