class context restrictions in GADT types not assumed
I think this should compile:
class C a where
f :: a -> Bool
data T a where
MkT :: (C a) => a -> T a
tf1 :: T Int -> Bool
tf1 (MkT aa) = f aa
tf2 :: T a -> Bool
tf2 (MkT aa) = f aa
tf1 does not give an error, but tf2 does. The type signature for tf2
should not need a class context, just as there's no "C Int" instance.
ThingEncoding.hs:32:23:
No instance for (C a)
arising from use of `f' at ThingEncoding.hs:32:23
Probable fix: Add (C a) to the type signature(s) for `tf2'
In the definition of `tf2': tf2 (MkT aa) = f aa
Edited by Simon Peyton Jones