
8 Aug
2013
8 Aug
'13
8:38 p.m.
Am 08/06/2013 07:01 PM, schrieb Stephen Tetley:
Hi Martin
If you are building syntax as a sequence of commands (or statements) a common idiom is to collect them with a Writer monad.
Andy Gill's Dotgen on Hackage is a nice realization of this idiom. See the how example included in the package has acceptably nice syntax without obliging the implementation to use complex facilities such as Template Haskell.
Thanks Stephen, exactly the nudge I was looking for, except I could not find any examples in the package. I had a brief look at the source code and it did not instantly reveal itself. Actually I already got stuck here: data Dot a = Dot { unDot :: Int -> ([GraphElement],Int,a) } Thanks Brent for you detailed explanation.