n. m. could be an AI
n. m. could be an AI

Reputation: 119847

ghc-mtl fails to build with ghc-7.8

I'm trying to build ghc-mtl-1.2.1.0 with ghc-7.8.3 and I'm getting these error messages:

Control/Monad/Ghc.hs:42:15:
    No instance for (GHC.MonadIO Ghc)
      arising from the 'deriving' clause of a data type declaration
    Possible fix:
      use a standalone 'deriving instance' declaration,
        so you can specify the instance context yourself
    When deriving the instance for (GHC.ExceptionMonad Ghc)

Control/Monad/Ghc.hs:46:15:
    No instance for (MonadIO GHC.Ghc)
      arising from the 'deriving' clause of a data type declaration
    Possible fix:
      use a standalone 'deriving instance' declaration,
        so you can specify the instance context yourself
    When deriving the instance for (MonadIO Ghc)

Control/Monad/Ghc.hs:49:15:
    No instance for (GHC.MonadIO Ghc)
      arising from the 'deriving' clause of a data type declaration
    Possible fix:
      use a standalone 'deriving instance' declaration,
        so you can specify the instance context yourself
    When deriving the instance for (GHC.GhcMonad Ghc)

Same errors with ghc-7.8.2.

I have tried to figure out which of the over 9000 types and/or modules called Ghc and/or GHC and/or MonadIO is responsible for this, but so far no luck.

So my questions are:

Upvotes: 2

Views: 204

Answers (1)

n. m. could be an AI
n. m. could be an AI

Reputation: 119847

Answering my own question.

The problem was the transformers-0.4.1.0 package, which was installed alongside transformers-0.3.0.0 that comes with ghc. The transformers package provides Control.Monad.IO.Class.MonadIO class. It was pulled into build twice, once from transformers-0.4.1.0 and once from transformers-0.3.0.0, which resulted in a conflict.

I have seen the duplicate package but didn't realize it was the source of the problem. My mistake was that I have hidden transformers-0.4.1.0 with ghc-pkg hide, tried to build ghc-mtl, the problem persisted, and I decided that transformers was not the reason. Hiding is of course not enough, I should have removed it instead.

Uninstalling transformers-0.4.1.0 and downgrading its dependencies solved the problem.

Upvotes: 1

Related Questions