Is Parsec's ParserError missing an Eq instance
Manuel Holtgrewe
purestorm at ggnore.net
Mon Sep 8 06:25:06 EDT 2008
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
More information about the Libraries
mailing list