ghc-mtl无法使用ghc-7.8构建

时间:2014-07-19 20:20:17

标签: haskell ghc ghc-api

我正在尝试使用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相同的错误。

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

所以我的问题是:

  • 造成这种破坏的原因是什么?
  • 是否可以在没有降级7.8.3的情况下修复它?

1 个答案:

答案 0 :(得分:1)

回答我自己的问题。

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

我已经看过重复的包但没有意识到它是问题的根源。我的错误是我隐藏了变形金刚-0.4.1.0与ghc-pkg hide,试图建立ghc-mtl,问题仍然存在,我认为变形金刚不是原因。隐藏当然是不够的,我应该将其删除。

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

相关问题