Skip to content

Commit

Permalink
Add FLIP infix operator: # (#73)
Browse files Browse the repository at this point in the history
* Add type-level op for FLIP

* Add changelog entry
  • Loading branch information
JordanMartinez authored Mar 17, 2022
1 parent 89c4d30 commit 038dd43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Breaking changes:
- Replaced polymorphic proxies with monomorphic `Proxy` (#72 by @JordanMartinez)

New features:
- Added `#` infix operator for `FLIP` (e.g. `Int # Maybe` == `Maybe Int`) (#73 by @JordanMartinez)

Bugfixes:

Expand Down
11 changes: 3 additions & 8 deletions src/Type/Function.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ infixr 0 type APPLY as $
-- |
-- | For example...
-- | ```
-- | FLIP Int Maybe == Maybe Int
-- | FLIP Int Maybe == Int # Maybe == Maybe Int
-- | ```
-- | Note: an infix for FLIP (e.g. `Int # Maybe`) is not allowed.
-- | Before the `0.14.0` release, we used `# Type` to refer to a row of types.
-- | In the `0.14.0` release, the `# Type` syntax was deprecated,
-- | and `Row Type` is the correct way to do this now. To help mitigate
-- | breakage, `# Type` was made an alias to `Row Type`. When the `# Type`
-- | syntax is fully dropped in a later language release, we can then
-- | support the infix version: `Int # Maybe`.
type FLIP :: forall a b. a -> (a -> b) -> b
type FLIP a f = f a

infixl 1 type FLIP as #

0 comments on commit 038dd43

Please sign in to comment.