我从沙箱中的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上查看at monad-control,那么就没有 StM
关联的新类型,但只有StT
关联类型。
除非这里有其他类型的诡计,否则我很难过。这将如何解决?谢谢。