HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Request an account if you don't have one.

Section of an infix operator

Categories: Glossary | Syntax

In Haskell there is a special syntax for partial application on infix operators. Essentially, you only give one of the arguments to the infix operator, and it represents a function which intuitively takes an argument and puts it on the "missing" side of the infix operator.


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

Note: as an exception, the "-" (subtraction) operator cannot do a right section, because that would be interpreted as unary negation in Haskell syntax. The Prelude function "subtract" is provided for this purpose. Instead of (- e), you need to write (subtract e).

See also

Retrieved from "http://haskell.cs.yale.edu/haskellwiki/Section_of_an_infix_operator"

This page has been accessed 4,468 times. This page was last modified 21:40, 1 February 2009. Recent content is available under a simple permissive license.