Module

Type.Row

Package
purescript-typelevel-prelude
Repository
purescript/purescript-typelevel-prelude

#RowApply Source

type RowApply (f :: Row Type -> Row Type) (a :: Row Type) = f a

Type application for rows.

#type (+) Source

Operator alias for Type.Row.RowApply (right-associative / precedence 0)

Applies a type alias of open rows to a set of rows. The primary use case this operator is as convenient sugar for combining open rows without parentheses.

type Rows1 r = (a :: Int, b :: String | r)
type Rows2 r = (c :: Boolean | r)
type Rows3 r = (Rows1 + Rows2 + r)
type Rows4 r = (d :: String | Rows1 + Rows2 + r)

Re-exports from Prim.Row

#Cons

class Cons (label :: Symbol) (a :: Type) (tail :: Row Type) (row :: Row Type) | label a tail -> row, label row -> a tail

The Cons type class is a 4-way relation which asserts that one row of types can be obtained from another by inserting a new label/type pair on the left.

#Lacks

class Lacks (label :: Symbol) (row :: Row Type) 

The Lacks type class asserts that a label does not occur in a given row.

#Nub

class Nub (original :: Row Type) (nubbed :: Row Type) | original -> nubbed

The Nub type class is used to remove duplicate labels from rows.

#Union

class Union (left :: Row Type) (right :: Row Type) (union :: Row Type) | left right -> union, right union -> left, union left -> right

The Union type class is used to compute the union of two rows of types (left-biased, including duplicates).

The third type argument represents the union of the first two.

Re-exports from Type.Data.Row

#RProxy Source

data RProxy (row :: Row Type)

A proxy data type whose type parameter is a type of kind # Type (a row of types).

Commonly used for specialising a function with a quantified type. For example, suppose we have an identity function for records of type:

recordIdentity :: forall row . RProxy row -> Record row -> Record row
recordIdentity _ rec = rec

Then applying this function to an RProxy with a specialised type allows us to specify a concrete type for row:

:t recordIdentity (RProxy :: RProxy ( x :: Int, y :: Int ))
{ x :: Int, y :: Int } -> { x :: Int, y :: Int }

Here row has been specialised to ( x :: Int, y :: Int ).

Constructors