Day 01
This commit is contained in:
20
day01/Commons.hs
Normal file
20
day01/Commons.hs
Normal file
@@ -0,0 +1,20 @@
|
||||
module Commons where
|
||||
|
||||
import System.IO
|
||||
import Text.Read
|
||||
|
||||
type CalibrationLine = String
|
||||
|
||||
type CalibrationDocument = [CalibrationLine]
|
||||
|
||||
parseLine :: IO CalibrationLine
|
||||
parseLine = do line <- getLine
|
||||
return line
|
||||
|
||||
parse :: IO CalibrationDocument
|
||||
parse = do done <- isEOF
|
||||
if done
|
||||
then return []
|
||||
else do line <- parseLine
|
||||
doc <- parse
|
||||
return (line:doc)
|
||||
Reference in New Issue
Block a user