Sunday, November 16, 2008

ZMidi

Copperbox revisions 331 & 332.

(331 - I missed adding the new files, added in 332).

I've added an new module Construction to ZMidi. This will probably replace SyntaxElements when it has more features and has been tested some more.

I realized yesterday, that SyntaxElements is next to useless for constructing Midi. Wrapping up the syntax tree in shorthand constructors misses a big point - constructing Midi is tedious because the syntax tree holds a lot of state (channel number, delta time) rather than tedious due to the syntax itself.

The Construction module has a rather odd interface - its basically a writer monad, although implemented as a state monad. The syntax tree is built with commands (i.e. functions that return unit - () ), rather than functions that return the partial tree as it is created. While this is hardly idiomatic for a Haskell library, it does mean that client programs can be pretty concise.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.