Files
aoc2024/lib/AoC.hs
Amneesh Singh 45347bf88b day 1
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2024-12-01 17:34:14 +05:30

11 lines
229 B
Haskell

module AoC where
import Text.Parsec
extract :: Either ParseError a -> a
extract (Left err) = error ("Parsing failed: " ++ show err)
extract (Right val) = val
count :: (Eq a) => a -> [a] -> Int
count x = length . filter (x ==)