1

I'm struggling a little to get this basic test-framework example to work with QuickCheck2. I get the following error that is mentioned on the above page, due to the example's use of QuickCheck 1. I assume that using QuickCheck2 is generally preferred, but how do I use it with test-framework?

Error:

No instance for (QuickCheck-1.2.0.0:Test.QuickCheck.Testable
    (Gen Prop))

Thanks in advance.


If I import Test.Framework.Providers.QuickCheck2, I get the following error:

del-me.hs:41:17:
    No instance for (QuickCheck-2.5.1.1:Test.QuickCheck.Property.Testable
                       (Gen Prop))
      arising from a use of `testProperty'
    Possible fix:
      add an instance declaration for
      (QuickCheck-2.5.1.1:Test.QuickCheck.Property.Testable (Gen Prop))
    In the expression: testProperty "sort2" prop_sort2
    In the second argument of `testGroup', namely
      `[testProperty "sort1" prop_sort1, testProperty "sort2" prop_sort2,
        testProperty "sort3" prop_sort3]'
    In the expression:
      testGroup
        "Sorting Group 1"
        [testProperty "sort1" prop_sort1, testProperty "sort2" prop_sort2,
         testProperty "sort3" prop_sort3]
Chris
  • 941
  • 9
  • 18

2 Answers2

2

Import Test.Framework.Providers.QuickCheck2 from the test-framework-quickcheck2 package, instead of Test.Framework.Providers.QuickCheck from the test-framework-quickcheck package.

dave4420
  • 46,404
  • 6
  • 118
  • 152
  • @Chris Are you hiding QuickCheck-1? The first faq on the page you linked to talks about explicitly hiding QuickCheck-2 if you want to use QuickCheck-1: you may need to explicitly hide QuickCheck-1 in the same way. Another possibility: do you have more than one version of QuickCheck-2 installed? If so, try hiding all except one of them. – dave4420 May 14 '13 at 13:41
  • 1
    It appears I've got some sort of dependency hell problem going on. Hiding one of the two versions of QuickCheck2 I have installed then breaks test-framework. Do you know of a simple way of resolving this kind of issue, please? – Chris May 14 '13 at 13:54
  • 1
    @Chris The only way I know of resolving this sort of thing is to delete your package database and reinstall all the packages you need :-( – dave4420 May 14 '13 at 14:23
1

Installing the newest test-framework-quickcheck2-0.3.0.2 is going to resolve this problem. E.g: If you have Haskell Platform installed just use the following commands:

cabal update

cabal install test-framework-quickcheck2-0.3.0.2
CRUSADER
  • 5,486
  • 3
  • 28
  • 64
sverien
  • 153
  • 6