[Haskell-cafe] Abuse of the monad

Colin Paul Adams colin at colina.demon.co.uk
Thu Mar 12 10:33:43 EDT 2009


>>>>> "Thomas" == Thomas Davie <tom.davie at gmail.com> 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.
-- 
Colin Adams
Preston Lancashire


More information about the Haskell-Cafe mailing list