[Haskell-cafe] Re: request for code review
benjamin.franksen at bessy.de
Wed Mar 15 03:53:20 EST 2006
On Tuesday 14 March 2006 20:58, you wrote:
> On 3/14/06, Benjamin Franksen <benjamin.franksen at bessy.de> wrote:
> > 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.
> Well, forgive me for my newbie-ness:
> o How important is it that I switch from using the State monad to
> using arrows? o How important is it that I switch from using |> or $
> to using arrows? (It seems that using arrows just to replace |> or $
> is like using a sledge hammer to drive a thumb tack.)
> o How much will this increase the "conceptual complexity" of my
> program--i.e. how much time am I going to have to spend explaining it
> in my article?
> o How much will this improve the readability or decrease the amount
> of code in my program?
More information about the Haskell-Cafe