[Haskell-cafe] Help using QuickCheck

Benjamin Franksen benjamin.franksen at bessy.de
Fri Oct 21 15:09:41 EDT 2005


On Friday 21 October 2005 20:14, Udo Stenzel wrote:
> Benjamin Franksen wrote:
> > I am asking help with using QuickCheck. I tried everything I could
> > think of, but invariably as soon as I start invoking the quickCheck
> > function on my property it fails with
> >
> >     No instances for (Arbitrary (OrdSeq Int), Show (OrdSeq Int))
>
> You need to define an `instance Arbitrary (OrdSeq Int)' for
> QuickCheck to be able to generate test data.  `instance Show (OrdSeq
> Int)' is needed so the offending example can be reported to you in
> case some test fails.  You should believe your compiler when it tells
> you
>
> >       add an instance declaration for (Arbitrary (OrdSeq Int), Show
> > (OrdSeq Int))
>
> ;-)
>
> > "No instance for (Show (IO ()))..."
>
> I think, this is an artefact of unresolved overloading or missing
> instances.  Somehow GHCi attaches an unnecessary implicit `print'. 
> When I played with QuickCheck, this error went away as soon as the
> rest of the expression type checked.

Many thanks! I wish I had remembered that I had this kind of problem 
before: ghc reports two errors, of which the /second/ one is the 'real' 
problem and the first one is just a by-product. This practically never 
happens with C compilers which I (must, sadly) use every day and thus I 
always tend to disregard all error messages but the first. And now as I 
think of it, it would indeed be quite hard for QuickCheck to guess hwo 
to generate my OrdSeqs.

Ben


More information about the Haskell-Cafe mailing list