[GHC] #1504: existentials containing type-class(dictionaries) require more type-signatures in 6.7

GHC trac at galois.com
Fri Jul 6 09:12:01 EDT 2007


#1504: existentials containing type-class(dictionaries) require more type-
signatures in 6.7
---------------------------+------------------------------------------------
  Reporter:  Isaac Dupree  |          Owner:         
      Type:  bug           |         Status:  new    
  Priority:  normal        |      Milestone:         
 Component:  Compiler      |        Version:  6.7    
  Severity:  normal        |       Keywords:         
Difficulty:  Unknown       |             Os:  Unknown
  Testcase:                |   Architecture:  Unknown
---------------------------+------------------------------------------------
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)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1504>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list