mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-12-27 02:02:42 +03:00
15 lines
305 B
Haskell
15 lines
305 B
Haskell
|
|
module Util where
|
|
|
|
import Text.Parsec
|
|
import Text.Parsec.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{} -> []
|