mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-12-25 09:12:29 +03:00
14 lines
304 B
Haskell
14 lines
304 B
Haskell
|
|
module Util where
|
|
|
|
import Text.Megaparsec
|
|
import Text.Megaparsec.String (Parser)
|
|
|
|
-- | Returns the error messages associated with a failed parse.
|
|
|
|
parseErrors :: Parser a -> String -> [String]
|
|
parseErrors p input =
|
|
case parse p "" input of
|
|
Left err -> drop 1 $ lines $ show err
|
|
Right _ -> []
|