Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2003-10-24 09:24:07


On Fri, Oct 24, 2003 at 04:04:01AM -0500, David B. Held wrote:
> "Brian McNamara" <lorgon_at_[hidden]> wrote in message
> > If we want to motivate monads in C++, it should be with
> > examples where structuring the program monadically
> > creates a winning generic design.
> > (Monadic parser combinators are perhaps a good example,
> > but they're also a big example, and it'll be a while before I
> > have anything to show in this domain.)
>
> Well, what I want to know is...do monads let you do things
> more elegantly than what Spirit does? Because that's a
> question whose answer I can get a hold on.

This is an excellent question.

I don't yet claim to know an answer. This is mostly because (a) I have
not taken a good hard look at Spirit yet, and because (b) I have not yet
fully developed monadic parser combinators in C++ yet to know if they
are as elegant as they are in Haskell (though preliminary results
suggest they will be, modulo the usual Haskell->C++ issues, like heavier
"typing").

If you want to investigate the question yourself in the meantime, you
can. If you know Spirit already, then just check out some or all of:

   "Monadic parser combinators" by Graham Hutton and Erik Meijer
   http://www.cs.nott.ac.uk/~gmh/bib.html#monparsing
    - a nice paper on the topic

   "Parsec, a fast combinator parser" by Daan Leijen
   http://www.cs.uu.nl/~daan/download/parsec/parsec.html
    - a Haskell library (not a good "intro"; read something else first)

   "Monadic Parser Combinators in C++", by me
   http://www.prism.gatech.edu/~gt5163b/Misc/monpar.html
    - just a little talk I am giving soon to our local research group

Hopefully this will afford you the general insights of the design of
such libraries.

-- 
-Brian McNamara (lorgon_at_[hidden])

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk