ghc fails to find the right instance

Joachim Breitner mail at
Tue Apr 1 13:12:49 EDT 2008


Am Dienstag, den 01.04.2008, 17:53 +0100 schrieb Claus Reinke:
> 'Integer -> a'  is more concrete, less general than 'i -> a',
> so it matches fewer types.
> '1 :: Num a => a' is more general than 'Integer'.
> |    No instance for (More (t -> Integer))
> |      arising from a use of `addd' at test.hs:19:17-22
> if nothing forces the parameter (!) to be Integer, the
> more concrete instance won't match. try type-annotating
> the numeric literals.

printI $ addd (1::Int) (2::Int) (3::Int)
does work.

But I can’t follow your explanation completely. When I use the variant
with Integer, ghc will not use the instance because (1::Num a => a) is
too general.

But why does it use the Integral i-Instance in the working variant?
(1::Num a=> a) is also more general than (1::Integral i => i), isn’t it?


Joachim "nomeata" Breitner
  mail: mail at | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nomeata at |
  Debian Developer: nomeata at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url :

More information about the Glasgow-haskell-users mailing list