refactor: reorder data structures for better readability

This commit is contained in:
wi11-holdsworth 2025-10-01 14:24:16 +10:00
parent df8bd3290f
commit 0b87d62ba0

View file

@ -56,25 +56,26 @@ import Debug.Trace
type GameState = [[Pitch]]
data Note = A | B | C | D | E | F | G
deriving (Eq, Show, Ord, Enum, Bounded)
data Octave = One | Two | Three
deriving (Eq, Ord, Enum, Bounded)
data Pitch = Pitch
{ note :: Note,
octave :: Octave
}
deriving (Eq, Ord)
instance Show Pitch where
show (Pitch note octave) = show note ++ show octave
data Note = A | B | C | D | E | F | G
deriving (Bounded, Enum, Eq, Ord, Show)
data Octave = One | Two | Three
deriving (Bounded, Enum, Eq, Ord)
instance Show Octave where
show One = "1"
show Two = "2"
show Three = "3"
instance Show Pitch where
show (Pitch note octave) = show note ++ show octave
-- ==== REQUIRED FUNCTIONS ====================================================
toPitch :: String -> Maybe Pitch