The Comonad.Readertypes, (co)monads, substructural logic

Slides from Hac Phi: “All About Monoids”

Some people have requested my slides from the short talk I gave about monoids and monoidal parsing at Hac Phi. So, here they are.

There will be more to come at the next Boston Haskell User Group in August, where it looks like I'll be giving two short talks covering monoids. I may use the monoidal parsing engine from Kata as an example for the advanced talk if I have time and will start to cover parsing larger classes of grammars in general (regular languages, CFGs/TIGs, TAGs, PEGs, LALR, attribute-grammars, etc.)

Discussion

stulliAugust 2nd, 2009 at 9:01 am

Hi, do you have a working code example for the file position example? I get following error:

`Reducer SourcePosition’ is not applied to enough type arguments
Expected kind `*’, but `Reducer SourcePosition’ has kind `* -> *’
In the instance declaration for `Reducer SourcePosition’
Edward KmeftAugust 3rd, 2009 at 6:33 am

@Stulli

Look on hackage at any revision of monoids before 0.2.0, and it will contain Data.Monoid.Lexical.SourcePosition — I recently slimmed the package down and plan to move the remaining functionality into a monoid-extras style package so that the core functionality is available without a laundry list of dependencies.

Your kind error comes from the fact that when I added Pos, I added an argument to the type to make it a Pointed Functor. So you need to make Monoid (SourcePosition f) and Reducer Char (SourcePosition f).

I explained the extra argument as part of the narrative during the talk, but naked slides do not provide me such opportunity for elaboration. :)

Original post and discussion · Download Markdown