module Syntax.TypeLevel.RowSyntax where-- "row kinds" look like "Row k" where 'k' is another kind.-- Usually, it's used with the kind, `Type`, to make Records (e.g. "Row Type")-- You cannot find that much documentation on `Row` kinds because-- they are built into the compiler.typeExample_of_an_Empty_Row :: forall k. Row ktypeExample_of_an_Empty_Row = ()typeExample_of_a_Single_Row_of_Types = (fieldName :: ValueType)typeExample_of_a_Multiple_Row_of_Types = (first :: ValueType, second :: ValueType)dataProxy :: forall k. k -> TypedataProxy kind = Proxyone_Key_Value_Pair :: Proxy (key :: Int)
one_Key_Value_Pair = Proxytwo_Key_Value_Pairs :: Proxy (key1 :: Int, key2 :: Int)
two_Key_Value_Pairs = Proxymany_Key_Value_Pair :: Proxy ( key1 :: Int
, key2 :: String-- , ...
, keyN :: (Int -> String)
)
many_Key_Value_Pair = Proxynested_Key_Value_Pair :: Proxy (outerKey :: Proxy (innerKey :: Int))
nested_Key_Value_Pair = Proxy-- Since row kinds can be used with other kinds, one could also define-- a row of Symbols:typeExample_of_a_Single_Row_of_Symbols = (a :: "asymbol")typeExample_of_a_Multiple_Row_of_Symbols = (a :: "asymbol", b :: "anothersymbol")-- These can also be used with the quoted-key syntax (explained previously in the-- Records folder):typeQuoted_Key_Row_of_Symbols = ("thekey" :: "thesymbol")row_of_symbols_proxy :: Proxy ( firstField :: "this is a symbol"
, secondField :: "this is another symbol"
)
row_of_symbols_proxy = Proxy{-
Just like Symbol, Row's other type-level programming constructs
are defined in the built-in `Prim` package and the `purescript-prelude` library.
-}-- needed to compiletypeValueType = String