Thu 20 Aug 2009
Iteratees, Parsec and Monoids (Slides)
Posted by Edward Kmett under Algorithms , Data Structures , Haskell , Mathematics , Monoids , Parsing[5] Comments
I was asked to give two talks at the Boston Area Haskell User Group for this past Tuesday. The first was pitched at a more introductory level and the second was to go deeper into what I have been using monoids for lately.
The first talk covers an introduction to the mathematical notion of a monoid, introduces some of the features of my Haskell monoids library on hackage, and starts to motivate the use of monoidal parallel/incremental parsing, and the modification use of compression algorithms to recycle monoidal results.
The second talk covers a way to generate a locally-context sensitive parallel/incremental parser by modifying Iteratees to enable them to drive a Parsec 3 lexer, and then wrapping that in a monoid based on error productions in the grammar before recycling these techniques at a higher level to deal with parsing seemingly stateful structures, such as Haskell layout.
Due to a late start, I was unable to give the second talk. However, I did give a quick run through to a few die-hards who stayed late and came to the Cambridge Brewing Company afterwards. As I promised some people that I would post the slides after the talk, here they are.
The current plan is to possibly give the second talk in full at either the September or October Boston Haskell User Group sessions, depending on scheduling and availability.
[ Iteratee.hs ]
August 21st, 2009 at 5:01 am
How is instance MonadPlus Iteratee defined?
August 21st, 2009 at 8:29 am
@Sebastian: I just added a source link at the bottom of the post for the Iteratee code. It doesn’t contain the monoidal layer, since that has changed quite a bit since this was written.
August 22nd, 2009 at 2:32 pm
Why didn’t you use monoids in the default implementation of supplyList? (foldMap over Dual Endo I think?)
Very cool stuff this!
August 23rd, 2009 at 6:04 am
@Sjoerd
Mostly to follow the original Iteratee write-up with the flip (.) combinator. That would be a perfectly valid approach as well.
August 25th, 2009 at 8:40 am
This is rather nice. I’m going to need some time to digest it (or should that be osmose?) :)