Is Parsec's ParserError missing an Eq instance

Hi I am trying to use HUnit to test my Parsec-based parsers. I have the following code: import Text.ParserCombinators.Parsec import Test.HUnit test1 = TestCase $ assertEqual "msg" (Right '1') (parse digit "error" "1") Running it gives the following error: HUnitParsec.hs:5:19: No instance for (Eq ParseError) arising from a use of `assertEqual' at HUnitParsec.hs:(5,19)- (8,32) Possible fix: add an instance declaration for (Eq ParseError) In the second argument of `($)', namely `assertEqual "msg" (Right '1') (parse digit "error" "1")' In the expression: TestCase $ assertEqual "msg" (Right '1') (parse digit "error" "1") In the definition of `test1': test1 = TestCase $ assertEqual "msg" (Right '1') (parse digit "error" "1") Is the missing Eq instance intentional? What is the recommended way to use HUnit to test Parsec parsers? Bests, Manuel

Hi Manuel,
Is Parsec's ParserError missing an Eq instance What is the recommended way to use HUnit to test Parsec parsers?
In my project, I implemented Eq for ParseError locally. {-# OPTIONS_GHC -fno-warn-orphans #-} import Text.ParserCombinators.Parsec.Error(ParseError, Message, errorMessages, messageEq) instance Eq ParseError where a == b = errorMessages a == errorMessages b instance Eq Message where (==) = messageEq I don't know if it was intentionally left out or not. You might get more responses on Haskell-Cafe. -Greg
participants (2)
-
Greg Fitzgerald
-
Manuel Holtgrewe