GHCi配置 - Haskell - 更改~/.ghci文件时出错

3

我试图按照以下链接的步骤让我的GHCi变得漂亮起来:http://www.reddit.com/r/haskell/comments/144biy/pretty_output_in_ghci_howto_in_comments/

但是在运行GHCi时出现了以下错误,导致我无法应用颜色更改。

user@pcname:~$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.

<no location info>:
    Could not find module `IPPrint'
    It is not a module in the current program, or in any known package.

<no location info>:
    Could not find module `Language.Haskell.HsColour'
    It is not a module in the current program, or in any known package.

<no location info>:
    Could not find module `Language.Haskell.HsColour.Colourise'
    It is not a module in the current program, or in any known package.

<no location info>:
    Could not find module `Language.Haskell.HsColour.Output'
    It is not a module in the current program, or in any known package.

<interactive>:7:21:
    Failed to load interface for `HsColour'
    Use -v to see a list of the files searched for.

<interactive>:9:26:
    Failed to load interface for `HsColour'
    Use -v to see a list of the files searched for.

Top level: Not in scope: `myPrint'

Top level: Not in scope: `myPrint'

<interactive>:19:26:
    Failed to load interface for `HsColour'
    Use -v to see a list of the files searched for.

你有什么建议吗?

我目前正在使用Ubuntu 14.04和GHCi 7.6.3。


你安装了必要的依赖吗?看起来你没有在系统范围内安装hscolour - bheklilr
那是我的问题,我不知道如何安装它们。 - magamig
我已经执行了“sudo aptitude install hscolour”,但安装后似乎没有起作用。 - magamig
如果可能的话,我建议使用cabal安装软件包。如果您没有安装它,请在aptitude中搜索,它可能被命名为cabal-install或类似的名称。cabal工具还有许多其他功能,例如用于创建和管理自己的项目。根据Reddit帖子中的说明,您需要使用cabal install IPPrintcabal install HsColour安装IPPrintHsColour软件包。如果这些成功安装,则不应该有任何问题。 - bheklilr
快成功了,但现在 cabal 给我这个错误 cabal: Error: some packages failed to install: Extra-1.46.1 依赖于 bzlib-0.5.0.4,但它无法安装。 bzlib-0.5.0.4 在配置步骤中失败。异常为: ExitFailure 1 ipprint-0.5 依赖于 bzlib-0.5.0.4,但它无法安装。 - magamig
显示剩余2条评论
1个回答

2

总结评论:您需要安装Haskell模块hscolouripprint。对于后者,您需要安装libbz2-dev包。因此:

sudo apt-get install libbz2-dev
cabal update
cabal install ipprint hscolour

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接