
1 Apr
2008
1 Apr
'08
3:11 p.m.
|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? because instance selection does not take instance contexts into account (a frequent source of feature requests;-): http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extension... so, the match is against 'i', and the 'Integral i' is added to the constraints needing proof *after* that instance has been chosen. claus