[Haskell-cafe] Composition Operator
Tony Morris
tmorris at tmorris.net
Sat Sep 22 00:40:56 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Apply parentheses from the right.
So:
(.) :: (b -> c) -> (a -> b) -> a -> c
is the same as:
(.) :: (b -> c) -> (a -> b) -> (a -> c)
is the same as:
(.) :: (b -> c) -> ((a -> b) -> (a -> c))
How you read that is up to you, but here is one way of reading it:
"accepts a function a to c and returns a function. The function returned
takes a function a to b and returns a function a to c"
The expression f(g(x)) in C-style languages is similar to (f . g) x
Tony Morris
http://tmorris.net/
PR Stanley wrote:
> Hi
> (.) :: (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
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG9JzXmnpgrYe6r60RAjDrAJ0SvkZHtNsctWNYHjqxjp9lnpNvgACfS/2r
9jwUvD29/ZMMot8x3/nvyI8=
=xSzA
-----END PGP SIGNATURE-----
More information about the Haskell-Cafe
mailing list