mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-12-17 21:31:42 +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 _ -> []
|