[Haskell-beginners] Debugging overlapping instances (mtl vs transformers)

Paolo Losi paolo.losi at gmail.com
Thu Sep 9 04:35:29 EDT 2010


Hi all,

I'm definitely stuck with the migration of my project
from mtl to transformers. The use of transformer is
mandated by a new dependency that I need to add.

     Overlapping instances for Monad (Either String)
       arising from a use of `tstampToForecasts'
                    at ThreeLab/Gfs.hs:94:32-55
     Matching instances:
       instance (Control.Monad.Trans.Error.Error e) => Monad (Either e)
         -- Defined in Control.Monad.Trans.Error
       instance Monad (Either e)
         -- Defined in mtl-1.1.1.0:Control.Monad.Error

I really have no clue of who and why is bringing mtl instance in the
scope.

If I compile the file directly with:

ghc -package monads-tf -package transformers -hide-package mtl 
ThreeLab/Gfs.hs -c

I can successfully compile the module, so it seems the problem
is not specific to that module. But the compilation fails
if I do ghc -package monads-tf -package transformers -hide-package mtl 
--make Main.hs

What's the best practice to debug this problem?
What are the constraints of indirectly depending on both mtl
and transformers?

I'm really stuck :-/

Thanks
Paolo



More information about the Beginners mailing list