[Haskell-cafe] message passing style like in Haskell?
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Jun 19 06:26:21 EDT 2008
On Thu, 2008-06-19 at 11:33 +0800, jinjing wrote:
> Hi guys,
>
> This is my second attempt to learn Haskell :)
>
> Any way here's the code:
>
> module Dot where
> import Prelude hiding ( (.) )
>
> (.) :: a -> (a -> b) -> b
> a . f = f a
>
> infixl 9 .
Note that if you redefine (.) composition to be backward application
(flip ($)) then nobody will understand your programs. It's also quite
probably that after reading your own code for a while that you'll not
understand the code that everyone else writes either! :-)
If you want an operator like that, I suggest picking some other symbol.
Duncan
More information about the Haskell-Cafe
mailing list