Module Function

This module provides some utility functions for function application.

Author: Bjoern Peemoeller

Version: July 2013

Summary of exported operations:

fix :: (a -> a) -> a   
fix f is the least fixed point of the function f, i.e.
on :: (a -> a -> b) -> (c -> a) -> c -> c -> b   
(*) \`on\` f = \\x y -> f x * f y.
first :: (a -> b) -> (a,c) -> (b,c)   
Apply a function to the first component of a tuple.
second :: (a -> b) -> (c,a) -> (c,b)   
Apply a function to the second component of a tuple.
(***) :: (a -> b) -> (c -> d) -> (a,c) -> (b,d)   
Apply two functions to the two components of a tuple.
(&&&) :: (a -> b) -> (a -> c) -> a -> (b,c)   
Apply two functions to a value and returns a tuple of the results.
both :: (a -> b) -> (a,a) -> (b,b)   
Apply a function to both components of a tuple.

Exported operations:

fix :: (a -> a) -> a   

fix f is the least fixed point of the function f, i.e. the least defined x such that f x = x.

on :: (a -> a -> b) -> (c -> a) -> c -> c -> b   

(*) \`on\` f = \\x y -> f x * f y. Typical usage: sortBy (compare \`on\` fst).

first :: (a -> b) -> (a,c) -> (b,c)   

Apply a function to the first component of a tuple.

second :: (a -> b) -> (c,a) -> (c,b)   

Apply a function to the second component of a tuple.

(***) :: (a -> b) -> (c -> d) -> (a,c) -> (b,d)   

Apply two functions to the two components of a tuple.

(&&&) :: (a -> b) -> (a -> c) -> a -> (b,c)   

Apply two functions to a value and returns a tuple of the results.

both :: (a -> b) -> (a,a) -> (b,b)   

Apply a function to both components of a tuple.