From 038dd43482de4ef66a0fcf06f18f8d6c1f22368e Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Thu, 17 Mar 2022 10:47:33 -0500 Subject: [PATCH] Add FLIP infix operator: # (#73) * Add type-level op for FLIP * Add changelog entry --- CHANGELOG.md | 1 + src/Type/Function.purs | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 917daeb..5692ca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/src/Type/Function.purs b/src/Type/Function.purs index e5c02a5..78440ad 100644 --- a/src/Type/Function.purs +++ b/src/Type/Function.purs @@ -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 #