> Does this also mean that a dictionary class is created for every class, and
> a dictionary created for every instance?
Yes, exactly. Every class is translated to a data type declaration,
and every instance is translated to an element of that data type - a
dictionary. (Note that you can't act
Bayley, Alistair wrote:
When it's applied, the compiler will know the types of the arguments, won't
it?. Which means that you would generate a version of double for each
(applied) instance of Num. I don't doubt that there's a good reason this is
not done: code bloat? or are there simply some expres
> > Is there
> > some way of preventing the type mechanism from generating
> code for the
> > instance type, as opposed to the class?
>
> I don't understand this question - does the explanation above help?
I could have been clearer with my questions. What I was wondering was: is
there some sit
Alistair Bayley writes:
> Warning: Defaulting the following constraint(s) to type `Integer'
>`Num a' arising from the literal `2' at Main.lhs:3
>
> This implies to me that the compiler is generating the code for (+) for the
> particular instance, rather than using a run-time dispa
> I had a discussion with someone over the type class mechanism and would like
> to clarify something.
>
> When I compile this trivial program:
>
> > module Main where
> > main = putStrLn (show (1 + 2))
>
> with ghc -Wall, the compiler says:
>
> Main.lhs:3:
> Warning: Defaulting the followi