megaparsec/test/Util.hs

15 lines
305 B
Haskell
Raw Normal View History

2014-09-25 05:10:39 +04:00
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{} -> []