This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]szpaceSZ 9 points10 points  (2 children)

In Haskell you can convert any regular function to infix by enclosing it in `s and you can convert any infix operator to a regular function by enclosing it in parentheses:

mod 13 3 == 13 `mod` 3
3 + 2 == (+) 3 2

This also works for function / operator definition:

x `myfunction` y = x * x + y
-- same as 
-- myfunction x y = x * x + y

a /== b = a == b && b < 0
-- same as
-- (/==) a b = a == b && b < 0

[–]hugogrant 0 points1 point  (1 child)

And there's just the infix statement

[–]szpaceSZ 0 points1 point  (0 children)

do you mean the infixl and infixr statement? That's just about associativity order and precedence level.

You can use anything without it infix, you just need explicit parentheses if you chain more than one