diff --git a/Proj2.hs b/Proj2.hs index cac7a3a..2e23371 100644 --- a/Proj2.hs +++ b/Proj2.hs @@ -12,14 +12,25 @@ where type GameState = () +data Note = A | B | C | D | E | F | G + deriving (Eq, Show, Ord) + +data Octave = One | Two | Three + deriving (Eq, Ord) + data Pitch = Pitch - { note :: Char, - octave :: Int + { note :: Note, + octave :: Octave } - deriving (Eq) + deriving (Eq, Ord) + +instance Show Octave where + show One = "1" + show Two = "2" + show Three = "3" instance Show Pitch where - show (Pitch note octave) = note : show octave + show (Pitch note octave) = show note ++ show octave toPitch :: String -> Maybe Pitch toPitch _ = Just (Pitch 'A' 1)