data Chord = Chord Int Modality [Annotate] deriving (Eq, Show, Read)
Note Chord
is used twice here. The two occurrences are used for two different things.
data Chord = -- This one defines a new data type
Chord Int Modality [Annotate] -- This one defines a new data constructor
It's OK to give the two things the same name because they exist in different namespaces.
data Event = Note Int | Chord Int Modality [Annotate] | Rest
Now you are trying to define another data constructor named Chord, which is a no-no. Data constructors must be unique across all data types in the module. If you want to use the Chord
type here, use it like this:
data Event = NoteEvent Int | -- A new data constructor, then optionally type(s)
ChordEvent Chord | -- A new data constructor, then optionally type(s)
OtherEvent -- A new data constructor, then optionally type(s)