logo       

[ ghc-Bugs-1097046 ] class context restrictions in GADT types not assumed: msg#00013

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-1097046 ] class context restrictions in GADT types not assumed

Bugs item #1097046, was opened at 2005-01-06 01:47
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Nobody/Anonymous (nobody)
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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise