3

我在沙盒中从 Hackage 安装最新的 ghc-mod (5.2.1.1) 时遇到此错误:

[15 of 38] Compiling Language.Haskell.GhcMod.CabalConfig ( Language/Haskell/GhcMod/CabalConfig.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/CabalConfig.o )
[16 of 38] Compiling Language.Haskell.GhcMod.CabalApi ( Language/Haskell/GhcMod/CabalApi.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/CabalApi.o )
[17 of 38] Compiling Language.Haskell.GhcMod.Cradle ( Language/Haskell/GhcMod/Cradle.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/Cradle.o )
[18 of 38] Compiling Language.Haskell.GhcMod.Monad ( Language/Haskell/GhcMod/Monad.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/Monad.o )

Language/Haskell/GhcMod/Monad.hs:370:5:
    Wrong category of family instance; declaration was for a type synonym
    In the newtype instance declaration for ‘StM’
    In the instance declaration for ‘MonadBaseControl IO (GhcModT m)’
cabal: Error: some packages failed to install:
ghc-mod-5.2.1.1 failed during the building phase. The exception was:
ExitFailure 1

我以前从未见过这个错误,所以我去挖掘了。在Language/Haskell/GhcMod/Monad.hs,果然它在做一些有趣的事情:

instance (MonadBaseControl IO m) => MonadBaseControl IO (GhcModT m) where
    newtype StM (GhcModT m) a = StGhcMod {
          unStGhcMod :: StM (StateT GhcModState
                              (ErrorT GhcModError
                                (JournalT GhcModLog
                                  (ReaderT GhcModEnv m) ) ) ) a } 
    liftBaseWith f = GhcModT . liftBaseWith $ \runInBase ->
        f $ liftM StGhcMod . runInBase . unGhcModT

如果您查看Hackage上的 monad-control则没有此类 StM关联的 newtype,而只有StT关联的类型。

除非这里有其他类型的诡计,否则我很难过。这将如何解决?谢谢你。

4

1 回答 1

3

划掉这个,我的眼睛在愚弄我。我的错误,自 monad-control-1.x 以来,MonadControl 具有关联类型而不是关联数据类型,如此所述。

于 2014-12-24T14:38:19.913 回答