Skip to content

Commit 53e0bff

Browse files
Add polymorphic type application in original and reversed forms
1 parent aa22055 commit 53e0bff

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Type/Row.purs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ module Type.Row
88
import Prim.Row (class Lacks, class Nub, class Cons, class Union)
99
import Type.Data.Row (RProxy(..)) as RProxy
1010

11+
-- | Polymorphic Type application
12+
-- |
13+
-- | For example...
14+
-- | ```
15+
-- | APPLY Maybe Int == Maybe $ Int == Maybe Int
16+
-- | ```
17+
type APPLY d c . (d c) d c
18+
type APPLY f a = f a
19+
20+
infixr 0 type APPLY as $
21+
22+
-- | Reversed polymorphic Type application
23+
-- |
24+
-- | For example...
25+
-- | ```
26+
-- | FLIP Int Maybe == Maybe Int
27+
-- | ```
28+
-- | Note: an infix for FLIP (e.g. `Int # Maybe`) is not allowed since
29+
-- | `# Type` is an alias for `Row Type`
30+
type FLIP d c . d (d c) c
31+
type FLIP a f = f a
32+
1133
-- | Type application for rows.
1234
type RowApply :: forall k. (Row k -> Row k) -> Row k -> Row k
1335
type RowApply f a = f a

0 commit comments

Comments
 (0)