[Haskell-cafe] Installing and running QuickCheck

adam at wyner.info adam at wyner.info
Tue Apr 12 15:08:06 EDT 2005


Hi Daniel,

Yes, importing Data.Char worked, but revealed other problems.  Now I get the
following.

ERROR "C:\Program Files\Hugs98\libraries\QuickCheck.hs":161 - Undefined variable
 "fromInt"
Monad>

This, however, I have seen before, and it has to do with different versions of
Prelude, where fromInt was removed and fromInteger put in.  From hugs-bugs, we
find that we need to just change fromInt to fromInteger on the appropriate
line.

http://www.haskell.org/pipermail/hugs-bugs/2005-January/001537.html


So, starting with line 160 of QuickCheck.hs should read:

instance Arbitrary Integer where
  arbitrary     = sized $ \n -> choose (-fromIntegral n,fromIntegral n)
  coarbitrary n = variant (fromInteger (if n >= 0 then 2*n else 2*(-n) + 1))

And with these two changes, QuickCheck compiles.  Now I have to see how it
works.

Thanks,
Adam

Quoting Daniel Fischer <daniel.is.fischer at web.de>:

> Hm,
>
> no instance Arbitrary Char is provided in the QuickCheck modules that came
> with my hugs or ghc. Probably the author just forgot to import Data.Char. Try
> inserting that in QuickCheck.hs.
>
> Hope that works,
> Daniel

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the Haskell-Cafe mailing list