gpt4 book ai didi

haskell - ghc-mod 期望 MonadBaseControl 具有 `StM` 关联的新类型而不是 `StT` 关联的类型

转载 作者:行者123 更新时间:2023-12-03 19:14:33 25 4
gpt4 key购买 nike

我在沙盒中安装来自 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

如果你看at monad-control在 Hackage 上,没有这样的 StM 关联的新类型,只有 StT 关联的类型。

除非这里发生了一些其他类型的诡计,否则我很难过。这将如何解决?谢谢。

最佳答案

抓破这个,我的眼睛在骗我。我的错误是,自 monad-control-1.x 以来,MonadControl 具有关联类型而不是关联数据类型,如解释的那样 here .

关于haskell - ghc-mod 期望 MonadBaseControl 具有 `StM` 关联的新类型而不是 `StT` 关联的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27638436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com