Skip to content

Commit 48c3154

Browse files
Port APPLY and FLIP to Type.Function
1 parent 87f7f22 commit 48c3154

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

src/Type/Function.purs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module Type.Function where
2+
3+
-- | Polymorphic Type application
4+
-- |
5+
-- | For example...
6+
-- | ```
7+
-- | APPLY Maybe Int == Maybe $ Int == Maybe Int
8+
-- | ```
9+
type APPLY :: forall a b. (a -> b) -> a -> b
10+
type APPLY f a = f a
11+
12+
infixr 0 type APPLY as $
13+
14+
-- | Reversed polymorphic Type application
15+
-- |
16+
-- | For example...
17+
-- | ```
18+
-- | FLIP Int Maybe == Maybe Int
19+
-- | ```
20+
-- | Note: an infix for FLIP (e.g. `Int # Maybe`) is not allowed.
21+
-- | Before the `0.14.0` release, we used `# Type` to refer to a row of types.
22+
-- | In the `0.14.0` release, the `# Type` syntax was deprecated,
23+
-- | and `Row Type` is the correct way to do this now. To help mitigate
24+
-- | breakage, `# Type` was made an alias to `Row Type`. When the `# Type`
25+
-- | syntax is fully dropped in a later language release, we can then
26+
-- | support the infix version: `Int # Maybe`.
27+
type FLIP :: forall a b. a -> (a -> b) -> b
28+
type FLIP a f = f a

src/Type/Row.purs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,6 @@ 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 :: forall a b. (a -> b) -> a -> b
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.
29-
-- | Before the `0.14.0` release, we used `# Type` to refer to a row of types.
30-
-- | In the `0.14.0` release, the `# Type` syntax was deprecated,
31-
-- | and `Row Type` is the correct way to do this now. To help mitigate
32-
-- | breakage, `# Type` was made an alias to `Row Type`. When the `# Type`
33-
-- | syntax is fully dropped in a later language release, we can then
34-
-- | support the infix version: `Int # Maybe`.
35-
type FLIP :: forall a b. a -> (a -> b) -> b
36-
type FLIP a f = f a
37-
3811
-- | Type application for rows.
3912
type RowApply :: forall k. (Row k -> Row k) -> Row k -> Row k
4013
type RowApply f a = f a

0 commit comments

Comments
 (0)