开发者

How to install generic haskell

开发者 https://www.devze.com 2023-02-28 06:49 出处:网络
after install hugs and then install ghc6 then install generic-haskell has the following message, How to do?

after install hugs and then install ghc6 then install generic-haskell has the following message, How to do?

# 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

in ubuntu i compile ghc-6.2.2 got the following error

/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

Any one have installed old version of GHC and generic haskell in ubuntu 10?

There are many pairs of version , i tried ghc-6.2.2 got above error, will i need to uninstall ubuntu 10 to install older version ubuntu to get it work? which version of ubuntu for which version of ghc work? http://www.cs.uu.nl/research/projects/generic-haskell/compiler.html


I tried installing generic-haskell myself from the source, I managed, and am able to describe how I fixed it. My installation platform is the Haskell Platform 2011.2.0.1-x86_64, but the following instruction are somewhat more general.

I met three problems, including the first one you describe (no. 3 below). For other users, I also describe the first two ones, which you probably solved as well.

1) Other users have first to fix an error depending on Data.Map.lookup type having changed, for containers >= 0.2.0.0: it used to return Monad m => m b (in containers-1.0.0.0), now it returns just Maybe b. I added calls to Data.Maybe.maybeToList to fix a few call-sites needing to use a list type; I bet you fixed the same error in some way. You can find this fix at: http://hpaste.org/47624.

2) Another error I had, with GHC 7, is that the configure script does not realize that it is newer than GHC 6.8, so it needs to also depend on containers. configure output included this line:

checking whether base package is split (GHC 6.8 or newer)... no

To fix this, you need to replace

if test $ghc_ma -ge 6 -a $ghc_mi -ge 8; then

with

if test $ghc_ma -eq 6 -a $ghc_mi -ge 8 -o $ghc_ma -ge 7; then

3) To fix your problem, you need to edit build/generic-haskell.cabal.pkg (assuming you are not doing an in-place installation with make in-place). You need to add an id: line and fix the depends line to use package-ids of packages present on your systems instead of package names. You can find out the ids using the following commands (output on my system included):

$ 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

The change to build/generic-haskell.cabal.pkg would then be:

-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

Furthermore, you need to add an id line to the same file - any id will do, as long as you change it if/when you reinstall the library. Here I've used:

id:             generic-haskell-1.80-lib-md5sum-2a7ae9d60440627618ad0b0139ef090b

I've also aligned all fields with spaces, as in the existing files. The syntax reference for this file can be found in: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/packages.html#installed-pkg-info


Apparently, the generic-haskell package depends on an old version of base.

The Haskell Platform specifies base-4.3.1.0, while generic-haskell needs an older version. Please contact the maintainers, or possibly, install an older version of GHC.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号