Skip to content

Add FLIP infix operator: # #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 #