Cleanup Day1 types
This commit is contained in:
@@ -18,22 +18,10 @@ import qualified Data.List as L
|
||||
import Data.Either
|
||||
|
||||
newtype CalorieCount = CalorieCount Int
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
newtype Elf = Elf CalorieCount
|
||||
|
||||
instance Show CalorieCount where
|
||||
show (CalorieCount c) = "Calories[" ++ show c ++ "]"
|
||||
|
||||
instance Show Elf where
|
||||
show (Elf (CalorieCount c)) = "Elf[" ++ show c ++ "]"
|
||||
|
||||
instance Eq CalorieCount where
|
||||
(==) (CalorieCount c1) (CalorieCount c2) = c1 == c2
|
||||
|
||||
instance Eq Elf where
|
||||
(==) (Elf (CalorieCount c1)) (Elf (CalorieCount c2)) = c1 == c2
|
||||
|
||||
instance Ord Elf where
|
||||
compare (Elf (CalorieCount c1)) (Elf (CalorieCount c2)) = compare c1 c2
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
elf :: Int -> Elf
|
||||
elf c = Elf (CalorieCount c)
|
||||
|
||||
Reference in New Issue
Block a user