You are right!
- This is the basic pseudo-polymorphic object.
- The idea is you can't cheat, and use the integer
- directly, but need to use the abstraction.
Is it possible to cheat? I would like to...
Thanks,
hugo
I think it is GHCi that is instantiating the type with (). Try compiling the program, it will probably be rejected by the compiler when you do not specify a concrete type.On Jun 17, 2008, at 11:53 AM, Hugo Pacheco wrote:
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?
Could someone please explain this to me? I'm not saying it does not make sense, but I would like to understand how it works. Being possible to change this behavior, this is, assign another "default type" whenever polymorphic types occur, would be awesome.
You can, for example, try this:
verboseCheck (tst :: [Int] -> Bool)
Cheers,
hugo