[Haskell-cafe] GHC 7/Cabal request for help

Rogan Creswick creswick at gmail.com
Thu Mar 24 18:22:36 CET 2011


On Thu, Mar 24, 2011 at 9:30 AM, Erik Hesselink <hesselink at gmail.com> wrote:
> I've just tested this, and with GHC 7, cabal chooses QuickCheck 2.4,
> whereas with GHC 6.12, it chooses 2.1.

I believe that the behavior you're seeing is because the package
selection is biased by the state of your local package databases
(plural, because there is a separate db for each version of GHC).  If
quickcheck 2.1 was installed with ghc 6.12, and satisfies the package
requirements, then cabal won't select a newer version on its own (at
least, that's my understanding).

If you either didn't have QuickCheck installed in your ghc7 package
db, or had v.2.4 installed, then ghc 7 would use that version.

Building with cabal-dev instead of cabal will use the most recent set
of satisfying dependencies according to your local hackage index,
rather than the compiled versions of packages you happen to have
around.  Alternatively, you can ghc-pkg unregister all the
dependencies from your local package db. (in this case, ghc-pkg
unregister QuickCheck-2.1, with ghc-pkg from 6.12, then cabal-install
testpack and you should see the failure).

--Rogan

> If I specify that 6.12 should
> choose 2.4 as well, I get the same issue there. This is to be
> expected, because I don't see the CPP checks you mentioned in
> Test/QuickCheck/Instances.hs in testpack-2.0.1. Perhaps you haven't
> released a version with those checks yet?
>
> Erik
>
> On Thu, Mar 24, 2011 at 14:18, John Goerzen <jgoerzen at complete.org> wrote:
>> Hi folks,
>>
>> I don't have a GHC 7 environment running yet (it's on my list...) but I
>> received a bug report pointing me at this build failure:
>>
>> http://hackage.haskell.org/packages/archive/testpack/2.0.1/logs/failure/ghc-7.0
>>
>> Among other things, this noted:
>>
>> Dependency QuickCheck >=2.1.0.3: using QuickCheck-2.4.0.1
>>
>> and the errors were:
>>
>> [1 of 3] Compiling Test.QuickCheck.Instances (
>> src/Test/QuickCheck/Instances.hs, dist/build/Test/QuickCheck/Instances.o )
>>
>> src/Test/QuickCheck/Instances.hs:39:10:
>>    Duplicate instance declarations:
>>      instance Arbitrary Word8
>>        -- Defined at src/Test/QuickCheck/Instances.hs:39:10-24
>>      instance Arbitrary Word8 -- Defined in Test.QuickCheck.Arbitrary
>>
>> src/Test/QuickCheck/Instances.hs:42:10:
>>    Duplicate instance declarations:
>>      instance CoArbitrary Word8
>>        -- Defined at src/Test/QuickCheck/Instances.hs:42:10-26
>>      instance CoArbitrary Word8 -- Defined in Test.QuickCheck.Arbitrary
>>
>> Now, that's fairly standard, and in fact, in my code, is wrapped with:
>>
>> #if MIN_VERSION_QuickCheck(2,3,0)
>>    -- we have Word8 instances here
>> #else
>> instance Arbitrary Word8 where
>>    arbitrary = sized $ \n -> choose (0, min (fromIntegral n) maxBound)
>>
>> instance CoArbitrary Word8 where
>>    coarbitrary n = variant (if n >= 0 then 2 * x else 2 * x + 1)
>>                where x = abs . fromIntegral $ n
>> #endif
>>
>> And that code has been working to support modern QuickCheck versions for
>> some time.
>>
>> It would appear that something in Cabal, GHC 7, or QuickCheck is breaking
>> this check.
>>
>> Ideas?
>>
>> -- John
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list