Copyright | Nils Anders Danielsson 2006 , Alexander Berntsen 2014 |
---|---|

License | BSD-style (see the LICENSE file in the distribution) |

Maintainer | libraries@haskell.org |

Stability | experimental |

Portability | portable |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

- Prelude re-exports
- Other combinators

Simple combinators working solely on and with functions.

Identity function.

Constant function.

(.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 Source

Function composition.

flip :: (a -> b -> c) -> b -> a -> c Source

`flip f`

takes its (first) two arguments in the reverse order of `f`

.

($) :: (a -> b) -> a -> b infixr 0 Source

Application operator. This operator is redundant, since ordinary application `(f x)`

means the same as `(f $ x)`

. However, `$`

has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example:

f $ g $ h x = f (g (h x))

It is also useful in higher-order situations, such as `map ($ 0) xs`

, or `zipWith ($) fs xs`

.

(&) :: a -> (a -> b) -> b infixl 1 Source

`&`

is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator `$`

, which allows `&`

to be nested in `$`

.

Since: 4.8.0.0

`fix f`

is the least fixed point of the function `f`

, i.e. the least defined `x`

such that `f x = x`

.

on :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 Source

`(*) `on` f = \x y -> f x * f y`

.

Typical usage: `sortBy (compare `on` fst)`

.

Algebraic properties:

© The University of Glasgow and others

Licensed under a BSD-style license (see top of the page).

https://downloads.haskell.org/~ghc/7.10.3/docs/html/libraries/base-4.8.2.0/Data-Function.html