【问题标题】:acid-state example error酸态示例错误
【发布时间】: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 &amp;&amp; cabal install cabalcabal 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


【解决方案1】:

这与您正在运行的架构完全无关(抱歉草率下结论)。

原来我有一些配置错误,或者可能安装了一些冲突的cabal 库。清除我的.ghc,然后重新安装适当的库就可以了。如果您使用的是 Debian 或同类产品:

rm -r ~/.ghc/*
cabal install acid-state

【讨论】:

    猜你喜欢
    • 2014-09-15
    • 1970-01-01
    • 2011-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-01
    • 1970-01-01
    相关资源
    最近更新 更多