Bugs item #1097046, was opened at 2005-01-06 09:47
Message generated for change (Settings changed) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1097046&group_id=8032

Category: Compiler (Type checker)
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ashley Yakeley (ashley-y)
>Assigned to: Simon Peyton Jones (simonpj)
Summary: class context restrictions in GADT types not assumed

Initial Comment:
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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1097046&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to