[hs] Solve 2019_06

This commit is contained in:
Joscha 2020-12-06 22:25:03 +00:00
parent f0faf2f591
commit 589eced514
3 changed files with 67 additions and 0 deletions

View file

@ -8,6 +8,7 @@ module Aoc.Parse
, untilSpace
, untilEol
, lineChar
, word
, digit
) where
@ -41,6 +42,9 @@ untilEol = takeWhileP (Just "non-newline character") (/= '\n')
lineChar :: Parser Char
lineChar = label "non-newline character" $ satisfy (/= '\n')
word :: Parser T.Text
word = takeWhileP (Just "alphanumeric character") isAlphaNum
digit :: Num a => Parser a
digit = foldr1 (<|>)
[ 0 <$ char '0'