Imported instance declarations

Simon Peyton-Jones simonpj at microsoft.com
Mon Oct 6 12:49:09 EDT 2003


This bad error message is improved in subsequent versions of GHC.  6.0.1
says

In.hs:5:
    Duplicate instance declarations:
      In.hs:5: Functor ((->) i)
      In module Control.Monad.Reader: Functor ((->) r)

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
On Behalf Of Frieder Kalisch
| Sent: 01 October 2003 15:12
| To: haskell at haskell.org
| Subject: Imported instance declarations
| 
| Hello,
| 
| While trying to learn Hakell I came across a weird (to me) error
message
| concerning imported instance declarations.
| 
| This module
| 
|     module XXX() where
| 
|     import Control.Monad.Error()
| 
|     instance Functor ((->)i) where
|       fmap = (.)
| 
| gives this error message (compiling with ghc 5.0.4.2):
| 
|     Duplicate instance declarations:
|       XXX.hs:5: Functor ((->) i)
|       <No locn>: Functor ((->) r)
| 
| For me this error message is somewhat puzzling: Where is the second
| instance declaration given? In this case it happens to be in
| Control.Monad.Reader, but how can I find out without looking for it
| in the CVS repository? The documentation for Control.Monad.Error does
| not mention the imported modules.
| 
| I suppose, that the compiler knows in which module the instance
| declaration was given, because it needs to tell duplicate import paths
| from duplicate instance declarations. Why is it not given in this
example?
| 
| Greetings
| 
|       Frieder Kalisch
| 
| 
| --
| Frieder Kalisch
| f.kalisch at tphys.uni-heidelberg.de
| +49-6221-549-432
| 
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell




More information about the Haskell mailing list