Reorganize imports
This commit is contained in:
24
src/Parse.hs
24
src/Parse.hs
@@ -2,14 +2,32 @@
|
||||
|
||||
module Parse where
|
||||
|
||||
import Lib (Parser)
|
||||
|
||||
import Common
|
||||
import Data.Function ((&))
|
||||
import Data.Text qualified as T
|
||||
import Data.Void
|
||||
import Text.Megaparsec qualified as M
|
||||
import Text.Megaparsec.Char qualified as MC
|
||||
import Text.Megaparsec.Char.Lexer qualified as MCL
|
||||
import Util (both)
|
||||
|
||||
someLines :: Parser a -> Parser [a]
|
||||
someLines p = p `M.sepEndBy1` MC.newline
|
||||
|
||||
number :: Parser Int
|
||||
number = MCL.decimal
|
||||
number = MCL.decimal
|
||||
|
||||
type Parser = M.Parsec Void T.Text
|
||||
|
||||
parsecDay ::
|
||||
Parser a ->
|
||||
(a -> Result, a -> Result) ->
|
||||
Day
|
||||
parsecDay parser parts =
|
||||
ParsecDay
|
||||
( \path text ->
|
||||
( case M.parse (parser <* M.eof) path text of
|
||||
Left e -> Left $ M.errorBundlePretty e
|
||||
Right parsedInput -> Right $ both (parsedInput &) parts
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user