【发布时间】:2012-11-06 22:50:02
【问题描述】:
我正在尝试将acid-state 用于一个项目,但在运行演示时遇到了麻烦。
在我的 64 位机器上从 this example collection 运行 HelloWorld.hs 会出现错误
acid-state.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)
acid-state.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 }
HelloWorldNoTH.hs 也会发生同样的事情。在 32 位系统上不会出现任何错误。有什么想法吗?我是否未能安装(或不正确地安装)某些必需的组件?
我正在使用 Cabal 0.14.0 在 64 位 Debian Wheezy(通过 haskell-platform 软件包安装)上运行“The Glorious Glasgow Haskell Compilation System, version 7.4.1”。机器本身是 64 位 Core i3。 32 位机器(成功运行了演示)没有明显的不同。
【问题讨论】:
-
这个问题和你之前的一个问题(导入 monad 转换器实例的两个问题)让我觉得你的/Debian 的 haskell 平台安装有问题。可能没用的建议:(1)运行
ghc-pkg check,(2)cabal install hsenv,创建一个新的项目目录和hsenv,cabal update && cabal install cabal,cabal update,使用新的cabal(0.16),最后cabal install acid-state happstack-server。跨度> -
我可以确认
HelloWorld.hs代码示例使用 Debian 打包的东西编译得很好。所以不妨试试rm -rf ~/.ghc并安装libghc-acid-state-dev,避免自己编译任何库。
标签: haskell compiler-errors acid-state