首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何安装通用haskell

如何安装通用haskell
EN

Stack Overflow用户
提问于 2011-04-21 11:40:33
回答 2查看 470关注 0票数 2

安装hugs后再安装ghc6再安装generic-haskell会出现以下信息,该怎么办?

代码语言:javascript
复制
# make package
Creating generic-haskell package ...
ghc-pkg: cannot find package generic-haskell
Reading package info from "generic-haskell.cabal.pkg" ... done.
generic-haskell-1.80: missing id field
generic-haskell-1.80: dependency "base-4.2.0.0" doesn't exist (use --force to override)
generic-haskell-1.80: dependency "haskell98-1.0.1.1" doesn't exist (use --force to override)
generic-haskell-1.80: dependency "containers-0.3.0.0" doesn't exist (use --force to override)
make: *** [package] Error 1

在ubuntu中,我编译ghc-6.2.2得到以下错误

代码语言:javascript
复制
/usr/bin/ghc -M -optdep-f -optdep.depend  -osuf o    -H16m -O HaskTags.hs

on the commandline:

    Warning: -optdep-f is deprecated: Use -dep-makefile instead
------------------------------------------------------------------------
==fptools== make boot - --no-print-directory -r;
 in /home/martin/ghc-6.2.2/ghc/utils/ghc-pkg
------------------------------------------------------------------------
/usr/bin/ghc -M -optdep-f -optdep.depend  -osuf o    -H16m -O -cpp -DPKG_TOOL -DWANT_PRETTY Main.hs Package.hs ParsePkgConfLite.hs Version.hs

on the commandline:
    Warning: -optdep-f is deprecated: Use -dep-makefile instead
make all
/usr/bin/ghc -H16m -O -cpp -DPKG_TOOL -DWANT_PRETTY    -c Main.hs -o Main.o  -ohi Main.hi

Main.hs:496:11:
    Ambiguous type variable `e' in the constraint:
      `Exception.Exception e'
        arising from a use of `Exception.throw' at Main.hs:496:11-25
    Possible cause: the monomorphism restriction applied to the following:
      my_catch :: forall a. IO a -> (e -> IO a) -> IO a
        (bound at Main.hs:499:0)
      my_throw :: forall a. e -> a (bound at Main.hs:496:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -XNoMonomorphismRestriction

Main.hs:498:13:
    Ambiguous type variable `e1' in the constraint:
      `Exception.Exception e1'
        arising from a use of `Exception.catch' at Main.hs:498:13-27
    Possible cause: the monomorphism restriction applied to the following:
      eval_catch :: forall a. a -> (e1 -> IO a) -> IO a
        (bound at Main.hs:498:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -XNoMonomorphismRestriction
make[4]: *** [Main.o] Error 1
make[3]: *** [boot] Error 2
make[2]: *** [boot] Error 1
make[1]: *** [boot] Error 1

有人在ubuntu 10中安装了旧版本的GHC和generic haskell吗?

有很多对的版本,我尝试了ghc-6.2.2得到了上面的错误,我需要卸载ubuntu 10来安装旧版本的ubuntu才能工作吗?哪个版本的ubuntu适用于哪个版本的ghc?http://www.cs.uu.nl/research/projects/generic-haskell/compiler.html

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-06-10 01:14:37

我试着自己从源代码上安装generic-haskell,我设法做到了,并且能够描述我是如何修复它的。我的安装平台是Haskell platform 2011.2.0.1-x86_64,但是下面的说明比较通用。

我遇到了三个问题,包括你描述的第一个问题(下面的第三个)。对于其他用户,我也描述了前两个问题,您可能也解决了这两个问题。

1)其他用户必须首先根据更改的Data.Map.lookup类型修复错误,对于containers >= 0.2.0.0:它过去返回Monad m => m b (在containers-1.0.0.0中),现在它只返回Maybe b。我添加了对Data.Maybe.maybeToList的调用,以修复一些需要使用列表类型的调用点;我敢打赌,您一定以某种方式修复了相同的错误。你可以在http://hpaste.org/47624上找到这个修复。

2)我在GHC 7中遇到的另一个错误是,配置脚本没有意识到它比GHC 6.8更新,因此它还需要依赖于容器。配置包含此行的输出:

正在检查基包是否拆分(GHC6.8或更高版本)...不是

要解决此问题,您需要替换

代码语言:javascript
复制
if test $ghc_ma -ge 6 -a $ghc_mi -ge 8; then

使用

代码语言:javascript
复制
if test $ghc_ma -eq 6 -a $ghc_mi -ge 8 -o $ghc_ma -ge 7; then

3)要解决您的问题,您需要编辑build/generic-haskell.cabal.pkg (假设您没有使用make in-place进行就地安装)。您需要添加id:行并修复依赖行,以使用系统上存在的包的package -id,而不是包名称。您可以使用以下命令(包括我的系统上的输出)找出ids:

代码语言:javascript
复制
$ ghc-pkg field base id
id: base-4.3.1.0-f5c465200a37a65ca26c5c6c600f6c76
$ ghc-pkg field haskell98 id
id: haskell98-1.1.0.1-150131ea75216886448a7146c9e0526b
$ ghc-pkg field containers id
id: containers-0.4.0.0-b4885363abca642443ccd842502a3b7e

然后,对build/generic-haskell.cabal.pkg的更改将是:

代码语言:javascript
复制
-depends:        base-4.3.1.0
-                haskell98-1.1.0.1
-                containers-0.4.0.0
+depends:        base-4.3.1.0-f5c465200a37a65ca26c5c6c600f6c76
+                haskell98-1.1.0.1-150131ea75216886448a7146c9e0526b
+                containers-0.4.0.0-b4885363abca642443ccd842502a3b7e

此外,您需要在同一文件中添加一个id行-任何id都可以,只要您在重新安装库时更改它即可。我在这里使用了:

代码语言:javascript
复制
id:             generic-haskell-1.80-lib-md5sum-2a7ae9d60440627618ad0b0139ef090b

我还将所有字段与空格对齐,就像在现有文件中一样。此文件的语法参考可在:http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/packages.html#installed-pkg-info中找到

票数 1
EN

Stack Overflow用户

发布于 2011-04-21 14:31:46

显然,generic-haskell包依赖于旧版本的base

Haskell Platform指定了base-4.3.1.0,而generic-haskell需要一个较旧的版本。请联系维护人员,或者可能安装较旧版本的GHC。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5739254

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档