[GHC] #2237: qualified names not permitted everywhere in instances

GHC trac at galois.com
Fri Apr 25 08:22:07 EDT 2008


#2237: qualified names not permitted everywhere in instances
-------------------------------+--------------------------------------------
 Reporter:  claus              |          Owner:         
     Type:  bug                |         Status:  new    
 Priority:  normal             |      Milestone:         
Component:  Compiler (Parser)  |        Version:  6.9    
 Severity:  normal             |     Resolution:         
 Keywords:                     |     Difficulty:  Unknown
 Testcase:                     |   Architecture:  Unknown
       Os:  Unknown            |  
-------------------------------+--------------------------------------------
Comment (by claus):

 Replying to [comment:1 simonpj]:
 > Looks fine to me. In your example program
 >  * You don't need the qualification on `fmap`; it's unambiguous without.

 but it isn't in scope! isn't it a bug that i can define `fmap` if it isn't
 in scope, but not `Prelude.fmap`, even though it is? and the unambiguity
 doesn't go all that far, either:
 {{{
 module QI where

 import Prelude hiding (Functor(..))
 import qualified Prelude (Functor(..))

 data X a = X a deriving Show

 instance Prelude.Functor X where
   fmap f (X a) = X (f a)
     where q = (reverse fmap,Prelude.fmap not [True],reverse QI.fmap)

 fmap = "fmap"
 }}}
 in `q`, `fmap` appears to refer to `QI.fmap`, not to `Prelude.fmap`, as it
 does in the `fmap` definition..

 >  * The instance for `Dope` really isn't H98 and is rejected for that
 reason.

 oops, yes. sorry about that (i'm constantly amazed at what isn't H98!-).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2237#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list