我在努力acid-state
。文档指出这Update st
是MonadState st
. 我尝试了不同的东西,但我的编译器不想看到 :( 我尝试了HelloWorld.hs
from examples,但遇到了同样的问题:
HelloWorld.hs:26:7:
No instance for (MonadState
HelloWorldState (Update HelloWorldState))
arising from a use of `put'
Possible fix:
add an instance declaration for
(MonadState HelloWorldState (Update HelloWorldState))
In the expression: put (HelloWorldState newValue)
In an equation for `writeState':
writeState newValue = put (HelloWorldState newValue)
HelloWorld.hs:29:43:
No instance for (MonadReader
HelloWorldState (Query HelloWorldState))
arising from a use of `ask'
Possible fix:
add an instance declaration for
(MonadReader HelloWorldState (Query HelloWorldState))
In a stmt of a 'do' block: HelloWorldState string <- ask
In the expression:
do { HelloWorldState string <- ask;
return string }
In an equation for `queryState':
queryState
= do { HelloWorldState string <- ask;
return string }
我做错了什么?如何让它发挥作用?
我正在使用
acid-state-0.6.4
,
ghc-7.4.2
,
debian-6.0.5
(amd64)
谢谢,尤拉斯
添加: 看起来它在 ghc-7.4.1 中有效,在 ghc-7.4.2 中无效。任何人都可以编译器吗?
我尝试重新安装酸状态,但没有帮助。ghc-7.4.2 中的错误或我的环境 ID 损坏。