Hi Heinrich and Simon,
I just discovered i-love-emily, which puts this conversation [1] in a whole new light. After looking at your code I think you are setting on a path do duplicate a lot of the structures in Music Suite, which probably benefits no one.
I now realise that it is not obvious from the Music Suite documentation how to get started with a *simple* representation. For example this code:
data Note = Note
{ pitch :: Int
, start :: Time
, duration :: Time
, channel :: Int
} deriving (Eq,Read,Show)
type Notes = [Note]
type Metadata = [(String,String)]
type Score = (Metadata, Notes)
could be rewritten as:
---------
import Music.Prelude.Basic hiding (Score, Note)
import qualified Music.Prelude.Basic as M
type Pitch = Int
type Channel = Int
newtype Note = Note { getNote :: (Pitch, Channel) }
type Score = M.Score Note
-- To get access to pitch and part combinators:
instance Wrapped where
type Unwrapped = Note (Pitch, Channel)
_Wrapped' = iso Note getNote
type instance Pitch Note = Pitch
type instance Part Note = Channel
instance HasPitch Note where
pitch = _Wrapped . _1
instance HasPitch Note where
pitch = _Wrapped . _2
Of course this is not exactly shorter, but consider the benefits: you get all the Music Suite combinators for manipulating time, pitch, meta-data, import and export. I spent a lot of time developing this and you probably don't want to waste time on low-level concepts that have already been implemented, especially since you already seem dedicated to depend on the Suite (for its notation output, I assume).
I would really like to make the Suite more accessible: in part by improving its design, but also (perhaps more importantly) its documentation and I could really use your (informal) feedback for this. In turn I'd be happy to help you navigate around any problems you run into.