[hs] Move parsing stuff to Aoc.Parse

This commit is contained in:
Joscha 2020-12-03 01:35:01 +00:00
parent b87c8e4555
commit 320fc25e06
2 changed files with 23 additions and 4 deletions

21
hs/src/Aoc/Parse.hs Normal file
View file

@ -0,0 +1,21 @@
module Aoc.Parse
( module Text.Megaparsec
, module Text.Megaparsec.Char
, module Text.Megaparsec.Char.Lexer
, Parser
, manyLines
) where
import Data.Void
import qualified Data.Text as T
import Text.Megaparsec
import Text.Megaparsec.Char
import Text.Megaparsec.Char.Lexer (binary, decimal, float,
hexadecimal, octal, scientific,
signed)
type Parser = Parsec Void T.Text
manyLines :: Parser a -> Parser [a]
manyLines p = sepBy p newline <* optional newline <* eof