1
0
Fork 0
advent-of-code/2022/haskell/src/Aoc.hs
2022-12-10 09:22:17 -05:00

11 lines
324 B
Haskell

module Aoc (runReadP) where
import Text.ParserCombinators.ReadP
runReadP :: ReadP a -> String -> a
runReadP p s = unwrap $ readP_to_S p s
where
unwrap [(a, "")] = a
unwrap [(_, _rs)] = error "Parser did not consume entire stream."
unwrap (_:as) = unwrap as
unwrap _ = error "Parser error."