[Haskell-cafe] Composition Operator
mutjida at gmail.com
Sat Sep 22 00:11:47 EDT 2007
It's probably easiest to think of composition as a function which
takes two arguments (both functions), (g :: b -> c) and (f :: a -> b),
and returns a new function of type a -> c. We could write this
composition :: (b -> c, a -> b) -> a -> c
composition (g,f) = \x -> g (f x)
then (.) is the currying of composition:
(.) = curry composition
(.) g f = \x -> g (f x)
On 9/21/07, PR Stanley <prstanley at ntlworld.com> wrote:
> (.) :: (b -> c) -> (a -> b) -> (a -> c)
> While I understand the purpose and the semantics of the (.) operator
> I'm not sure about the above definition.
> Is the definition interpreted sequentially - (.) is a fun taht takes
> a fun of type (b -> c) and returns another fun of type (a -> b) etc?
> Any ideas?
> Thanks, Paul
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe