Skip to content

Commit 7b1cf30

Browse files
stephencelishdgarrood
authored andcommitted
Haskell Differences: Operator Sections (documentationjs#49)
1 parent 9086883 commit 7b1cf30

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

language/Differences-from-Haskell.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,22 @@ apply f x = f x
242242
infixr 0 apply as $
243243
```
244244

245+
## Operator Sections
246+
247+
In Haskell, there is syntactic sugar to partially apply infix operators.
248+
249+
```haskell
250+
(2 ^) -- desugars to `(^) 2`, or `\x -> x ^ 2`
251+
(^ 2) -- desugars to `flip (^) 2`, or `\x -> 2 ^ x`
252+
```
253+
254+
In PureScript, operator sections look a little bit different.
255+
256+
```purescript
257+
(2 ^ _)
258+
(_ ^ 2)
259+
```
260+
245261
## Extensions
246262

247263
The PureScript compiler does not support GHC-like language extensions. However, there are some "built-in" language features that are equivalent (or at least similar) to a number of GHC extensions. These currently are:

0 commit comments

Comments
 (0)