Bulat Ziganshin | 10 Aug 22:18 2005

Re: Practical introduction to monads

Hello Paul,

Wednesday, August 03, 2005, 12:03:49 AM, you wrote:

PM> One thing I haven't found a really good discussion of, is practical
PM> examples of building monads. There's plenty of discussion of the IO

i recall one more usage of monads - to do parsing. read the following:

http://www.cs.nott.ac.uk/~gmh//pearl.pdf
http://www.cs.nott.ac.uk/~gmh//pearl.hs

that is really beatiful - parsing monad used both for holding state (position
in input stream) and to backtrack to alternative rules when parsing
with current rule fails. these ideas also used in ParseC (parser
combinators) library, which are widely used (read
http://www.cs.uu.nl/people/daan/download/parsec/parsec.html)

btw, just obstacles with creating more advanced parsing libraries
with help of monads lead to inventing of arrows - more generalized
variant of monads (see
http://www.cs.chalmers.se/~rjmh/Papers/arrows.pdf)

ps: another example can be CPS (continuation passing style) monads,
but i know nothing about it, except for name :)  may be someone can
point me to tutorial? :)

--

-- 
Best regards,
 Bulat                            mailto:bulatz <at> HotPOP.com

Gmane