diff --git a/2022/day02/day02.hs b/2022/day02/day02.hs index 132adf2..7e63f80 100644 --- a/2022/day02/day02.hs +++ b/2022/day02/day02.hs @@ -1,9 +1,8 @@ data Hand = Rock | Paper | Scissor deriving (Eq,Enum,Bounded,Show) instance Ord Hand where - compare x y = case fromEnum x - fromEnum y `mod` 3 of + compare x y = case (fromEnum x - fromEnum y) `mod` 3 of 0 -> EQ 1 -> GT - (-2) -> GT _ -> LT (+.) :: Hand -> Int -> Hand