existentials containing type-class(dictionaries) require more type-signatures in 6.7
I don't understand the "rules" well enough to know if this is actually a bug, or if the type signature is supposed to be required. (Also I need to update my build of HEAD... but before I forget,)
{-# LANGUAGE ExistentialQuantification #-}
module Test where
import Data.Typeable
data D = forall a. Typeable a => D a
--type signature only required in 6.7, not 6.6.1
fromD :: Typeable result => D -> result -> Bool
fromD (D a) def =
typeOf a == typeOf def
ghc 6.7's error message when the type signature is commented out:
ghc67tysigreg.hs:10:15:
Could not deduce (Typeable a) from the context (Typeable a1)
arising from a use of `typeOf' at ghc67tysigreg.hs:10:15-24
Possible fix:
add (Typeable a) to the context of the constructor `D'
In the second argument of `(==)', namely `typeOf def'
In the expression: (typeOf a) == (typeOf def)
In the definition of `fromD':
fromD (D a) def = (typeOf a) == (typeOf def)
Trac metadata
Trac field | Value |
---|---|
Version | 6.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |