[Haskell-cafe] message passing style like in Haskell?

Brent Yorgey byorgey at gmail.com
Thu Jun 19 15:24:19 EDT 2008


On Thu, Jun 19, 2008 at 3:35 AM, Ketil Malde <ketil at malde.org> wrote:

> jinjing <nfjinjing at gmail.com> writes:
>
> > Any way here's the code:
>
> > module Dot where
> > import Prelude hiding ( (.) )
>
> > (.) :: a -> (a -> b) -> b
> > a . f = f a
>
> > infixl 9 .
>
> Isn't this (roughly?) the same as flip ($)?
>
> As a side note, may I advise you to use another symbol, and leave the
> poor dot alone? Overloading it as a module separator is bad enough.
> If you have a keyboard that allows greater-than-ascii input, there are
> plenty of options: « » ¡ £ ¥ ł € (R) ª...
>

Note that there already is a standard symbol for this, (>>>) from
Control.Arrow.  Well, actually (>>>) is more general than backwards function
composition, so maybe making your own symbol is still a good idea while
you're learning.

-Brent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080619/f67657f2/attachment.htm


More information about the Haskell-Cafe mailing list