On 12 Mar 2009, at 15:33, Colin Paul Adams wrote:

"Thomas" == Thomas Davie <[email protected]> writes:

   Thomas> On 12 Mar 2009, at 15:16, Andrew Wagner wrote:

Can you expand on this a bit? I'm curious why you think this.

   Thomas> For two reasons:

   Thomas> Firstly, I often find that people use the Monadic
   Thomas> interface when one of the less powerful ones is both
   Thomas> powerful enough and more convenient, parsec is a wonderful
   Thomas> example of this.  When the applicative instance is used
   Thomas> instead of the monadic one, programs rapidly become more
   Thomas> readable, because they stop describing the order in which
   Thomas> things should be parsed, and start describing the grammar
   Thomas> of the language being parsed instead.

That's interesting.

I recently used parsec 3. I wrote using the monadic interface because
I could understand (just about) how to do so. I was looking at the
examples in RWH, and I could follow the explanation of the monadic
interface much easier.
Perhaps this was because RWH shows how to write using the monadic
interface, and then shows how to convert this to the applicative
interface.
It's hard to follow a tutorial that shows you how to convert from
something you aren't starting with.

I suspect that this is an interesting corner case of both my two reasons – firstly, Monads are too powerful here, and secondly, you perhaps found it easier to think about the operational aspects of the parser than to think about the denotation of what the parser should parse.

Is that somewhere accurate?

Bob_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to