Module

Data.Record

Package
purescript-record
Repository
purescript/purescript-record

#get Source

get :: forall a l r' r. IsSymbol l => RowCons l a r' r => SProxy l -> Record 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 Source

set :: forall b a l r r2 r1. IsSymbol l => RowCons l a r r1 => RowCons l b r r2 => SProxy l -> b -> Record r1 -> Record 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 Source

modify :: forall b a l r r2 r1. IsSymbol l => RowCons l a r r1 => RowCons l b r r2 => SProxy l -> (a -> b) -> Record r1 -> Record 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 Source

insert :: forall a l r2 r1. IsSymbol l => RowLacks l r1 => RowCons l a r1 r2 => SProxy l -> a -> Record r1 -> Record 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. RowLacks "x" r => a -> { | r } -> { x :: a | r }

#delete Source

delete :: forall a l r2 r1. IsSymbol l => RowLacks l r1 => RowCons l a r1 r2 => SProxy l -> Record r2 -> Record 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. RowLacks "x" r => { x :: a | r } -> { | r }

#rename Source

rename :: forall output inter input ty next prev. IsSymbol prev => IsSymbol next => RowCons prev ty inter input => RowLacks prev inter => RowCons next ty inter output => RowLacks next inter => SProxy prev -> SProxy next -> Record input -> Record 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. RowLacks "x" r => RowLacks "y" r => { x :: a | r} -> { y :: a | r}

#equal Source

equal :: forall rs r. RowToList r rs => EqualFields rs r => Record r -> Record r -> Boolean

Check two records of the same type for equality.

#EqualFields Source

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

Members

Instances