Section of an infix operator

From HaskellWiki
Revision as of 14:04, 3 July 2007 by Lemming (talk | contribs) (sectioning examples taken from article Currying)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

In Haskell there is a special syntax for partial application on infix operators.

  • (2^) is equivalent to (^) 2
  • (^2) is equivalent to flip (^) 2


Like partial application and lambda abstraction, sectioning provides a convenient way of writing some functions without having to explicitly name them:

  • (1+) (unsugared: (+) 1) is the "increment" function,
  • (2*) is the "double" function,
  • ('\t':) is the "indent" function,
  • (`elem` "AEIOU") is the "is-capital-vowel-in-English" function (ignoring the "sometimes Y").

See also