[Haskell-beginners] Chain computations

Tim Baumgartner baumgartner.tim at googlemail.com
Sat Nov 20 12:10:22 EST 2010


Hi,

I really like fooling around with operators. In elementary school, we
always had to make chain computations, e.g.

teacher: 2
teacher: +1
teacher: *2
teacher: divided by 3

Again, I didn't find the following operator on hoogle (very similar to ($)):
(->>) :: a -> (a -> b) -> b
a ->> f = f a

Using it, we can nicely write down the above computation:
2 ->> (+1) ->> (*2) ->> (`div` 3)

Cheers
Tim


More information about the Beginners mailing list