Polymorphic \"constants\", like 5 :: Num a => a
, aren\'t really constants but functions of a dictionary argument. Hence, if you define
primes ::
It's fairly impossible for a fairly technical reasons. Type classes are open so, the polymorphic constant can't at compile time necessarily "see" how many types satisfy the constraint so it can't allocate that many monomorphic thunks. On the other side, a type class certainly can't see all the possible constants that it might generate, so the monomorphic thunks cannot be allocated in the type class dictionary.
You will have to explicitly mention any types at which you want a monomorphic thunk allocated.