Type.Row
- Package
- purescript-typelevel-prelude
- Repository
- purescript/purescript-typelevel-prelude
#RowListRemove Source
class RowListRemove (label :: Symbol) (input :: RowList) (output :: RowList) | label input -> outputRemove all occurences of a given label from a RowList
Instances
RowListRemove label Nil Nil(RowListRemove label tail tailOutput, Equals label key eq, If eq (RLProxy tailOutput) (RLProxy (Cons key head tailOutput)) (RLProxy output)) => RowListRemove label (Cons key head tail) output
#RowListSet Source
class RowListSet (label :: Symbol) (typ :: Type) (input :: RowList) (output :: RowList) | label typ input -> outputAdd a label to a RowList after removing other occurences.
Instances
(TypeEquals (SProxy label) (SProxy label'), TypeEquals typ typ', RowListRemove label input lacking) => RowListSet label typ input (Cons label' typ' lacking)
#RowListNub Source
class RowListNub (input :: RowList) (output :: RowList) | input -> outputRemove label duplicates, keeps earlier occurrences.
Instances
RowListNub Nil Nil(TypeEquals (SProxy label) (SProxy label'), TypeEquals head head', TypeEquals (RLProxy nubbed) (RLProxy nubbed'), RowListRemove label tail removed, RowListNub removed nubbed) => RowListNub (Cons label head tail) (Cons label' head' nubbed')
#RowListAppend Source
class RowListAppend (lhs :: RowList) (rhs :: RowList) (out :: RowList) | lhs rhs -> outInstances
(TypeEquals (RLProxy rhs) (RLProxy out)) => RowListAppend Nil rhs out(RowListAppend tail rhs out', TypeEquals (RLProxy (Cons label head out')) (RLProxy out)) => RowListAppend (Cons label head tail) rhs out
#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
#Lacks
#Nub
#Union
class Union (left :: Row Type) (right :: Row Type) (union :: Row Type) | left right -> union, right union -> left, union left -> rightThe 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 Prim.RowList
#Cons
#RowToList
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 ).