megaparsec/test/Util.hs
2014-09-24 20:24:45 -05:00

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{} -> []