[Haskell-beginners] Re: Non-recursive binding expression

Ertugrul Soeylemez es at ertes.de
Sat Feb 28 18:44:31 EST 2009


Will Ness <will_n48 at yahoo.com> wrote:

> BTW could there be a use for something like
>
>  infixl 1 #
>
>  x # f = f x    -- (#) = flip ($)
>
> to have the direct data flow reflected in our code, so that your code
> would become
>
>  test = [] # (3:) # (8:) # (7:)
>
> maybe sometimes it's more natural to think of data being "piped
> through" the chain of functions, and to write them down in forward,
> not reverse order of application?

I think, it's more natural to think in terms of functions, and often the
argument to a function is not just something as simple as [] anyway.  If
you want to think in chaining instead of composition, you can use arrow
sequencing (>>>) instead of function composition (.):

  import Control.Arrow

  test = (3:) >>> (8:) >>> (7:) $ []


Greets,
Ertugrul.


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/




More information about the Beginners mailing list