[Haskell-cafe] Re: request for code review

Benjamin Franksen benjamin.franksen at bessy.de
Tue Mar 14 10:39:14 EST 2006


On Tuesday 14 March 2006 14:46, Pete Chown wrote:
> Shannon -jj Behrens wrote:
> > Arrows looks like a replacement for monads.  Are you saying
> > I should drop my use of the State monad?  If so, why?  I like the
> > readability of the do syntax.
>
> Okay, now it's my turn to ask a question. :-) I've read about arrows,
> and while I think I see what they do, I'm not sure why they are seen
> as so special that they even get new syntax.  This question of
> Shannon's is exactly the point I struggle with.  I can see that the
> arrow operators might be useful with functions, but are they useful
> for other things too?

Yes, http://www.haskell.org/arrows/biblio.html lists a number of papers 
describing non-trivial applications of Arrows, that is, Arrows other 
than (->). I found the exposition in 
http://www.haskell.org/yale/papers/oxford02/ to be quite readable.

> For example, as monads are one kind of arrow, 
> I thought I would make some of the I/O functions into arrows and see
> what happened.  The result was pretty much the same as using the
> monad, except slightly less convenient.

You can write monadic code without ever using the syntax sugar, and get 
along. However, do-notation is convenient. OTOH, I am told that 
programming with Arrows is really quite inconvenient w/o the syntax 
sugar.

Cheers,
Ben


More information about the Haskell-Cafe mailing list