[<<][compsci][>>][..]
Sun Mar 7 10:14:27 CET 2010

Arrows

To understand arrows is to understand their basic combinators[1].  As
a concrete example one could think of arrows as a generalization of
functions.

> instance Arrow (->) where
>   arr f    = f
>   f >>> g  = g . f
>   first  f = \(x,y) -> (f x,   y) -- for comparison's sake
>   second f = \(x,y) -> (  x, f y) -- like first
>   f *** g  = \(x,y) -> (f x, g y) -- takes two arrows, and not just one
>   f &&& g  = \x     -> (f x, g x) -- feed the same input into both functions

[1] http://en.wikibooks.org/wiki/Haskell/Understanding_arrows




[Reply][About]
[<<][compsci][>>][..]