Skip to content

Commit d2c4a22

Browse files
authored
Merge pull request #35 from natefaubion/row-apply
Add RowApply operator
2 parents f03c6a9 + 27ca222 commit d2c4a22

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Type/Row.purs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module Type.Row
1212
, class RowListSet
1313
, class RowListNub
1414
, class RowListAppend
15+
, RowApply
16+
, type (+)
1517
) where
1618

1719
import Type.Equality (class TypeEquals)
@@ -142,3 +144,16 @@ instance rowListAppendCons
142144
, TypeEquals (RLProxy (Cons label head out')) (RLProxy out) )
143145
=> RowListAppend (Cons label head tail) rhs out
144146

147+
-- | Type application for rows.
148+
type RowApply (f :: # Type -> # Type) (a :: # Type) = f a
149+
150+
-- | Applies a type alias of open rows to a set of rows. The primary use case
151+
-- | this operator is as convenient sugar for combining open rows without
152+
-- | parentheses.
153+
-- | ```purescript
154+
-- | type Rows1 r = (a :: Int, b :: String | r)
155+
-- | type Rows2 r = (c :: Boolean | r)
156+
-- | type Rows3 r = (Rows1 + Rows2 + r)
157+
-- | type Rows4 r = (d :: String | Rows1 + Rows2 + r)
158+
-- | ```
159+
infixr 0 type RowApply as +

0 commit comments

Comments
 (0)