From e9710a5bf85ad5964c630bba42040b03a8767266 Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:52:37 +1000 Subject: [PATCH] refactor: improve flow of file by ordering functions better --- Proj2.hs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Proj2.hs b/Proj2.hs index deb4846..67ac910 100644 --- a/Proj2.hs +++ b/Proj2.hs @@ -13,6 +13,8 @@ where import Data.List import Data.Set qualified as S +-- datatypes -- + type GameState = [[Pitch]] data Note = A | B | C | D | E | F | G @@ -35,6 +37,10 @@ instance Show Octave where instance Show Pitch where show (Pitch note octave) = show note ++ show octave +-- + +-- required functions -- + toPitch :: String -> Maybe Pitch toPitch [note, octave] = Pitch <$> charToNote note <*> charToOctave octave where @@ -83,6 +89,14 @@ initialGuess = (chord, chords) where chord : chords = allChords +-- implement me +nextGuess :: ([Pitch], GameState) -> (Int, Int, Int) -> ([Pitch], GameState) +nextGuess (prevGuess, chord : chords) _ = (chord, chords) + +-- + +-- helper functions -- + allChords :: [[Pitch]] allChords = [ chord @@ -108,6 +122,4 @@ allOctaves = [minBound .. maxBound] allNotes :: [Note] allNotes = [minBound .. maxBound] --- implement me -nextGuess :: ([Pitch], GameState) -> (Int, Int, Int) -> ([Pitch], GameState) -nextGuess (prevGuess, chord : chords) _ = (chord, chords) +--