2

我正在尝试使用 ghc-7.8.3 构建 ghc-mtl-1.2.1.0 并且收到以下错误消息:

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)

与 ghc-7.8.2 相同的错误。

我试图找出 9000 多个类型和/或模块中的哪一个被称为Ghc和/或GHC和/或MonadIO 对此负责,但到目前为止还没有运气。

所以我的问题是:

  • 造成这种破损的原因是什么变化?
  • 是否可以在不从 7.8.3 降级的情况下修复它?
4

1 回答 1

1

回答我自己的问题。

问题是transformers-0.4.1.0 软件包,它与ghc 附带的transformers-0.3.0.0 一起安装。变压器包提供Control.Monad.IO.Class.MonadIO类。它被拉入构建两次,一次来自transformers-0.4.1.0,一次来自transformers-0.3.0.0,这导致了冲突。

我看过重复的包,但没有意识到这是问题的根源。我的错误是我用 隐藏了transformers-0.4.1.0 ghc-pkg hide,尝试构建ghc-mtl,问题仍然存在,我认为不是transformers 的原因。隐藏当然是不够的,我应该删除它。

卸载 transformers-0.4.1.0 并降级其依赖项解决了这个问题。

于 2014-07-20T19:18:32.667 回答