[Haskell-cafe] Parsers are monadic?
bayer at cpw.math.columbia.edu
Sat Jun 30 12:05:37 EDT 2007
On Jun 30, 2007, at 6:31 AM, Claus Reinke wrote:
> has anyone else had similar experiences with expressive limitations
> of monadic programming? things that one might be able to work
> around, but that don't feel as natural or simple as they should be?
> things that one hasn't been able to express at all (such as Swierstra
> & Duponcheel's static analysis of combinator parsers which
> inspired Hughes's proposal to use arrows)?
When you pretend you've never heard of monads or arrows, and write
down the types what do you get?
When I finally overcame my resistance to monads, I only had to change
names in my code to use the Maybe monad, the functions already had
the right type. There's an inevitability to monads and arrows, and
perhaps to what you're thinking, if it's a third species in a lazy
list we're evaluating of such things.
Haskell does suffer from misrepresentation to outsiders. Even already
familiar with ML and Ocaml, the "lazy, pure" approach read to me like
a fetish, and monads seemed a tainted construct for if one absolutely
must venture into the practical. The only reason I could see to learn
Haskell was a sense that nevertheless comes through and probably puts
some people off, that Haskell programmers are in the highest reading
group. (Lisp programmers imagine that they are; one should learn
both.) If one must suffer through the drudgery of using a
programming language, shouldn't it be a window to enlightenment that
Aldous Huxley would admire? Haskell delivers, but I avoided monads to
get the "pure" experience, when in fact Haskell is all about
supporting functional idioms like monads.
The references cited in this thread are excellent. They certainly
gave me more insight into the history of how Haskell evolved: Classes
coming from Gofer precisely to make monads more elegant to use, and
do notation a mutant form of monad comprehensions.
I went chasing references but couldn't substantiate this statement on
page 11 of
1996 Hutton, Meijer - Monadic parser combinators
> Indeed, the algebraic properties required of the monad operations
> turn out to be precisely
> those required for the notation to make sense.
How do I reconcile this with the extension of do notation to support
If monads and arrows are two instances of something akin to "group
theory" then the definition of a "group" is lurking within whatever
this quote should have said...
More information about the Haskell-Cafe