
18 Mar
2011
18 Mar
'11
10 p.m.
Hi, I'm writing a music library and have the following types and functions: data Note = C | D | E | F | G | A | B | Sharp Note | Flat Note raise C = Sharp C data Quality = Major | Minor data Chord = Chord Quality Note -- Note is the root data Scale = Scale Quality Note -- Note is the tonic What I would like to do is to be able to lift the raise function and apply it to Chords and Scales. Something like this: fmap raise (Chord Major C) = Chord Major (Sharp C) But these are not functors as it doesn't seem to make sense for them to be polymorphic. A chord can't really made of anything except Notes. Does anybody have any ideas? Patrick -- ===================== Patrick LeBoutillier Rosemère, Québec, Canada