6 ms·
Nit, but a single | can't be an operator in Haskell.
by dllthomas 4y ago
Nit, but a single | can't be an operator in Haskell.
- eru 4y agoTrue, I got that piece of the syntax wrong. I guess you can do something very close, though.
- dllthomas 4y agoAbsolutely. Almost every group of symbols can be used as an operator, just (as it happens) not a single | because that is reserved for patterns.
- nequo 4y agoHaskell has `&` in Data.Function. You can try it in ghci: Prelude> f a x = a * x Prelude> g x = x + 2 Prelude> g $ f 3 $ 5 17 Prelude> :m +Data.Function Prelude Data.Function> 5 & f 3 & g 17 It is like `$` but with the arguments flipped: ($) :: (a -> b) -> a -> b (&) :: a -> (a -> b) -> b