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.

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.