Monday, June 30, 2008

Bala

Copperbox revision 162.

Minor updates to various files - making the MIDI modules use export lists. Some work on chords, though they don't handle inversions properly.

Sunday, June 29, 2008

Bala

Copperbox revisions 160 & 161.

Revision 160
More tidying up in Bala.Base especially the interval module. I'm still not happy with the interval module, but this check in does improve it.

I've started moving named elements into their respective modules (pitches in Pitch, intervals in Interval), the NamedElements module will be removed some time soon.


Revision 161
Chord was broken in revision 160 - a judicious use of undefined. It is back working now, though it needs a lot of improvement.

Saturday, June 28, 2008

Bala

Copperbox revision 159.

More tidying up in Bala.Base. Simplified the type-classes in Pitch and stopped some of the Enum instances in Pitch generating negative numbers. Removed the Extract type-class from BaseExtra.

Bala

Copperbox revision 158.

Code tidied up in BaseExtra and PitchConversion. Both modules now have export lists rather than exporting everything. PitchConversion has its alternative pitch representations made into opaque types.

Friday, June 27, 2008

Bala

Copperbox revision 156 & 157.

Revision 156

Pitch is now an opaque type - its constructor/destructor is not exported outside the Pitch module (the Pitch module is the new name for the PitchRep module). This is so that consistency between the pitch name (pitch letter and accidental) and semitone count can be ensured.

This has caused a cascade of changes as other modules can no longer pattern match on Pitch. Although everything should compile, there will be quite a lot of tidying up still to do as I look for code that is now redundant.

Also the tests have been made to run again - they had been left in the cold while I had been working on SymLilyPond.


Revision 157

Changes to Interval - the arith_dist field label has been changed to interval_type.

Thursday, June 26, 2008

Bala

Copperbox revision 155.

A couple of changes to SymLilyPond and some restructuring in Bala.Base.

I've limited accidentals to natural, sharp, flat, double sharp and double flat. Plus I've moved some of the pitch operations inside the PitchRep module as I think making the Pitch datatype opaque would be beneficial (so it can track the invariants it has on semitone 'measure').

Wednesday, June 25, 2008

Bala

Copperbox revision 154.

A rethink of attributes for SymLilyPond and SymAbc. Attributes are no longer a 'continuation' (repr (a ctx) -> repr (a ctx)) over an element, they are now just elements. To establish that one element is a attribute of another element there is a empty class:

class Attribute elt attrib

Declaring instances of Attribute will put an attribute relation on the two types, then attribution can be done with the SymAttr class or its helper (#@).

Pleasantly this is both simpler and more useful that the continuation version.

Tuesday, June 24, 2008

Bala

Copperbox revision 153.

Some more work on SymLilyPond - vertical placement isn't right, so this check in is all the current changes before I put some more work into it.

Vertical placement should be an attribute of an attribute, because only certain attributes can have there placement altered:

- A note's finger position could be above it or below it, it is an extra glyph (a number) printed with the note.

- A note's duration effects how the note is printed (solid, with stem...) but it prints a singular glyph so can't have its placement altered.

Currently SymLilyPond lets any attribute get a vertical placement. This is wrong - outputting a note that has been given a vertical placing for it's duration turns the duration into a fingering. I'll have to do some thinking about this.

Also with this checking I've added some handwritten LilyPond examples so I can compare them to which the output that SymLilyPond produces.

Monday, June 23, 2008

Bala

Copperbox revision 152.

SymAbc and SymLilyPond - I've now replaced the old concatenation with the new snoc list version. The old (+++) operator has been kept and is now an alias for 'snoc' (cSnoc).

Sunday, June 22, 2008

Bala

Copperbox revision 151.

A new implementation of concatenation as a snoc list. This should be used to replace old version in due course. I've left old version in the code for the time being as there aren't any name clashes, though it would be nice to reclaim the (+++) operator.

A useful property of the snoc list version is that the 'nil' type (cNil) is parameterized by its context (the old version had no nil representation). This puts the type checker to work for us, elementCtx and toplevelCtx are differently typed nils:

pitches_001 () = elementCtx `cSnoc` (note _g) `cSnoc` (note _c)

pitches_002 () = toplevelCtx `cSnoc` (note _g) `cSnoc` (note _c)

pitches_001 compiles because notes are at the element context, but pitches_002 fails as notes can't exist at the toplevel context.

Bala

Copperbox revision 150.

More work on the SymLilyPond parser.

Yesterdays example for parsing with attributes didn't work when I got round to testing it, chaining attributes with bind (>>=) forces them to be present when we want them to be optional:

pitchA = pPitch >>= pAccidental >>= pMicroTone >>= pOctaveSpec

The new revision uses an alternative to bind (##) that allows the parse to be optional:

pitchA = lexeme $ pPitch ## pAccidental ## pMicroTone ## pOctaveSpec

The parser currently falls down on concatenation - i.e. it cannot handle lists of notes inside a block. I suspect that I'll have to rework how concatenation is handled with in the final-tagless datatypes.

Saturday, June 21, 2008

Bala

Copperbox revision 149.

Tentative work on the SymLilyPond parser - enough to parse pitch with some attributes (accidental, octave spec).

Unlike the pretty printer which is open to adding new elements, I think the parser will have to be 'knot-tied'. For example, the parser pitchA (pitch with attributes) explicitly lists which attributes it will parse and their order:

pitchA = pPitch >>= pAccidental >>= pMicroTone >>= pOctaveSpec

Naturally, all attributes are optional - but they still need to be enumerated in one place in advance.

Friday, June 20, 2008

Bala

Copperbox revisions 147 & 148.

Revision 147 - added quite a lot of missing LilyPond elements to SymLilyPond, especially percussion in 'Instrument-specific notation'.

Revision 148 - some more updates to SymLilyPond.

Thursday, June 19, 2008

Bala

Copperbox revision 146.

More Haddock documentation updates (principally to SymLilyPond). Plus SymAbc - made all the fields separate final-tagless elements.

Wednesday, June 18, 2008

Bala

Copperbox revision 145.

Added some more Haddock docs to Base.BaseExtra.

Tuesday, June 17, 2008

Bala

Copperbox revision 144.

Added Haddock section header marks to SymLilyPond, so I can keep track of how much syntax I've covered.

Monday, June 16, 2008

Bala

Copperbox revision 143.

Changed the commands in SymLilyPond from using a generic representation (cmdZero, cmdOne, etc.) to each having and separate datatype and Sym_ class like other syntax elements.

Using the common representation (nullary commands were represented by cmdZero, unary commands cmdOne) meant that hacks were going in for special cases when it can to the P (pretty print) interpretation - double quoted strings were given a special type, more GHC extensions were needed.

With each command now represented individually, SymLilyPond is both simpler and more uniform (at the cost of some more boilerplate).

Sunday, June 15, 2008

Bala

Copperbox revision 142.

More updates to the SymLilyPond library.

Bala

Copperbox revisions 140 & 141.

Revision 141 adds changes to SymBase that were missed in 140 (140 will note compile).

The final tagless versions (SymLilyPond and SymAbc) can now generate output for their respective formats - the files DemoSymLy.hs and DemoSymabc.hs have tentative examples. There is still a lot of work to do, but to me this feels like a milestone.

I've added a datatype MeterFraction that represents fractions that shouldn't be normalized. Previously meters were represented by the Rational datatype from the standard libraries , but this normalizes fractions - 4/4 automatically becomes 1/1. This is not the required behavior for time signatures.

Saturday, June 14, 2008

Bala

Copperbox revision 139.

I've moved common code from SymAbc and SymLilyPond into a common module SymBase. Also more updates to both SymAbc and SymLilyPond.

Friday, June 13, 2008

Bala

Copperbox revision 138.

Some updates to SymAbc to handle mid-tune fields, plus more substantial updates to SymLilyPond.

Rather than use optional fields in the datatype constructors (using the SymMaybe wrapper), SymLilyPond now uses attributes like SymAbc.

Attributes a really just functions attr -> val -> val but wrapped up in the final tagless style, plus the reverse application operator to make them postix. So a note 'c_' with a duration attribute of 4 becomes:

note c_ # dur 4

Thursday, June 12, 2008

Bala

Copperbox revision 137.

I've added a version of Abc format in the 'final tagless' style. As Abc has a smaller grammar than LilyPond it has been easier to experiment with this version. Notably I've worked out fitting together different elements of the grammar with three operators inspired by Text.Html in the standard libraries.

(+++) concatenates elements at the same 'level' in the grammar.

(#) is reversed function composition (.) and it is used to add optional attributes to elements. For instance a note may have an optional octave specification and accidental.

(<<) is ($) but with higher precedence, so that elements that are n-ary functions can be applied to their sub-elements without needed extraneous parentheses.

Thursday, June 5, 2008

Bala

Copperbox revision 136.

Some updates to SymLilyPond. I think have sorted out a context scheme to make LilyPond output well-formed (or at least better-formed), so I'm checking in SymLilyPond before I make significant changes to it.

Monday, June 2, 2008

Bala

Copperbox revision 135.

Added an alternative implementation of the LilyPond format library.

The new version is in the 'Finally tagless' style, which should give me modular syntax (important because the LilyPond grammar is pretty big). I've been working for the last month on experiments to get modular syntax and the 'Finally tagless' approach seems the most appropriate one. There is still quite a bit of work to do - both to add the missing parts of the grammar that are in the previous version and to add 'contexts' to the grammar so that ill-formed output cannot be produced.

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.