From 0ce98af86817f7d2678230d7472d9bfa445daf80 Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:33:28 +1100 Subject: [PATCH] refactor: fully qualify Set module for clarity --- Proj2.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Proj2.hs b/Proj2.hs index 025371f..66657b2 100644 --- a/Proj2.hs +++ b/Proj2.hs @@ -58,7 +58,7 @@ import Data.Function (on) import Data.List import Data.Map qualified as Map import Data.Ord (comparing) -import Data.Set qualified as S +import Data.Set qualified as Set -- ==== DATA STRUCTURES ======================================================= @@ -142,17 +142,17 @@ feedback target guess = (pitches, notes, octaves) where -- since pitches are unique in a guess, -- we can use set math to count how many are correct - targetSet = S.fromList target - guessSet = S.fromList guess + targetSet = Set.fromList target + guessSet = Set.fromList guess - pitchSet = S.intersection targetSet guessSet + pitchSet = Set.intersection targetSet guessSet pitches = length pitchSet -- since notes and octaves are not unique in a guess, -- we can compare the guess to all possible permutations of the target -- and count the pairwise note/octave matches - targetNoPitches = S.toList $ S.difference targetSet pitchSet - guessNoPitches = S.toList $ S.difference guessSet pitchSet + targetNoPitches = Set.toList $ Set.difference targetSet pitchSet + guessNoPitches = Set.toList $ Set.difference guessSet pitchSet notes = matches (map note targetNoPitches) (map note guessNoPitches) octaves = matches (map octave targetNoPitches) (map octave guessNoPitches)