Imported instance declarations

Frieder Kalisch f.kalisch at tphys.uni-heidelberg.de
Wed Oct 1 17:11:44 EDT 2003


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



More information about the Haskell mailing list