[Haskell-beginners] What's the difference between "operator" and "function"?
Christopher Done
chrisdone at googlemail.com
Mon Oct 10 14:20:17 CEST 2011
2011/10/10 Costello, Roger L. <costello at mitre.org>:
> What's the difference between operator and function?
http://www.haskell.org/onlinereport/exps.html#sect3.2
> An operator is either an operator symbol, such as + or $$, or is an ordinary identifier enclosed in grave accents (backquotes), such as `op`. For example, instead of writing the prefix application op x y, one can write the infix application x `op` y. If no fixity declaration is given for `op` then it defaults to highest precedence and left associativity (see Section 4.4.2).
>
> Dually, an operator symbol can be converted to an ordinary identifier by enclosing it in parentheses. For example, (+) x y is equivalent to x + y, and foldr (*) 1 xs is equivalent to foldr (\x y -> x*y) 1 xs.
More information about the Beginners
mailing list