[Haskell-cafe] Polymorphic QuickCheck arguments

Hugo Pacheco hpacheco at gmail.com
Tue Jun 17 06:13:35 EDT 2008


It does not seem like printing the result value from IO (), because with a
more complicated example for lists.
t :: [a] -> Bool
t x = True

then it randomly generates values of type [()].

*Quick> verboseCheck t
0:
[]
1:
[()]
2:
[(),(),()]
3:
[]
4:
[()]
5:
[(),(),(),()]

I just wonder how the a got instantiated to ().

Thanks,
hugo


On Tue, Jun 17, 2008 at 11:05 AM, Dougal Stanton <dougal at dougalstanton.net>
wrote:

> 2008/6/17 Hugo Pacheco <hpacheco at gmail.com>:
> > Hi all,
> > There is something about polymorphic tests in QuickCheck that I do not
> > understand.
> > If you write the simplest dummy test function
> > tst :: a -> Bool
> > tst _ = True
> > and evaluate it we get
> >> verboseCheck tst
> > 0:
> > ()
> > 1:
> > ()
> > ...
> > How come did the polymorphic value a get instanciated to ()? Is this done
> > via the Testable type class?
>
> I haven't got something here to check with, but from the formatting it
> looks like every odd line is a randomly-chosen boolean value, and the
> following line is the result? It might be just printing the result
> value of IO (). Maybe try a more complete test to see how that looks?
>
> Cheers,
>
> D
>
>
> --
> Dougal Stanton
> dougal at dougalstanton.net // http://www.dougalstanton.net
>



-- 
www.di.uminho.pt/~hpacheco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080617/5633e6c1/attachment.htm


More information about the Haskell-Cafe mailing list