1 module Advent
.Input
where
4 import Text
.Regex
.TDFA
.String ()
6 -- TODO: Fully automatic input format detection and parsing.
8 findAll
:: String -> String -> [String]
9 findAll r x
= getAllTextMatches
$ x
=~ r
11 findAllRead
:: Read b
=> String -> String -> [b
]
12 findAllRead
= (map read .) . findAll
14 findAllNums
:: String -> [Int]
15 findAllNums
= findAllRead
"[0-9]+"