
1 Dec
2009
1 Dec
'09
10:48 a.m.
Hi all, I want to make all types that are instances of Integral instances of another type class, i.e: {-# LANGUAGE FlexibleInstances #-} class Intable a where toInt :: a -> Int instance (Integral a) => Intable a where toInt l = fromIntegral l However this gives the following error that I don't understand: q.hs:6:0: Constraint is no smaller than the instance head in the constraint: Integral a (Use -XUndecidableInstances to permit this) In the instance declaration for `Intable a' Can anyone offer insight on thie error? Also, is there perhaps a different way to do what I want to do? Thanks, Patrick -- ===================== Patrick LeBoutillier Rosemère, Québec, Canada