How to install generic haskell - haskell

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.

Related

stack fails to build monad-mersenne-random-0.1 package

I'm trying to install moo stackage and it has the monad-mersenne-random dependency which is giving me the following error. The stack project is fresh created. I tried to add the dependency to the configuration files but it didn't help, and I got the same error.
# stack build monad-mersenne-random-0.1
gives me:
>>/tmp/stack8403/monad-mersenne-random-0.1/Control/Monad/Mersenne/Random.hs:50:10: error:
>> • No instance for (Applicative Rand)
>> arising from the superclasses of an instance declaration
>> • In the instance declaration for ‘Monad Rand’
>> |
>> 50 | instance Monad Rand where
>> | ^^^^^^^^^^
This library is somewhat too old. GHC version from 7.10 or above can't compile it
If you need to use Random library, you can find another alternative such as MonadRandom
IMO, GHC 8.4 is too new for production, many libraries haven't supported it yet. You should use GHC 8.2.2 or below

Haskell error with cabal: no instance for

I'm trying to follow the steps for installation for derivation of software product lines called hephaestus-pl. However, at the time of performing the installation steps, according to the tutorial, there is an error when executing the cabal install command on all cloned repositories. The erros is:
$ sudo cabal install
Resolving dependencies...
Notice: installing into a sandbox located at
/home/notebook/workspace/hephaestus/hephaestus-sb
Configuring funsat-0.6.2...
Building funsat-0.6.2...
Failed to install funsat-0.6.2
Build log ( /home/notebook/workspace/hephaestus/hephaestus-sb/logs/funsat-0.6.2.log ):
cabal: Entering directory '.'
Configuring funsat-0.6.2...
Building funsat-0.6.2...
Preprocessing library funsat-0.6.2...
[ 4 of 10] Compiling Funsat.Monad ( src/Funsat/Monad.hs, dist/dist-sandbox-cf02e0bc/build/Funsat/Monad.o )
src/Funsat/Monad.hs:64:10: error:
• No instance for (Applicative (SSTErrMonad e st s))
arising from the superclasses of an instance declaration
• In the instance declaration for ‘Monad (SSTErrMonad e st s)’
src/Funsat/Monad.hs:88:10: error:
• Could not deduce (GHC.Base.Alternative (SSTErrMonad e st s))
arising from the superclasses of an instance declaration
from the context: Error e
bound by the instance declaration at src/Funsat/Monad.hs:88:10-52
• In the instance declaration for ‘MonadPlus (SSTErrMonad e st s)’
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
funsat-0.6.2 failed during the building phase. The exception was:
ExitFailure 1
I'm using the following version of ghci, which came installed along with the haskell-platform:
$ ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
The cabal version is:
$ cabal --version
cabal-install version 1.24.0.1
compiled using version 1.24.1.0 of the Cabal library
My operating system is debian 9.2.
This is failing to compile due to the Functor/Applicative/Monad proposal implemented in more recent versions of GHC. The code would originally have compiled just fine, but in recent versions of GHC, you cannot declare something as Monad without first declaring it as Functor and Applicative. You used to be able to, but now you cannot.
The library authors need to update the library's code to fix this new restriction.

Random Word8 duplicate instance declaration during cabal testpack installation

What does the following error message mean when cabal install testpack-2.1.1 has failed:
... Everything above this succeeded with no problems.
[22 of 22] Compiling Control.Monad.Cont ( Control/Monad/Cont.hs, dist/build/Control/Monad/Cont.o )
Registering mtl-2.2.1...
Installing library in /home/ely/.cabal/lib/mtl-2.2.1/ghc-7.4.2
Registering mtl-2.2.1...
Downloading testpack-2.1.1...
Configuring testpack-2.1.1...
Building testpack-2.1.1...
Preprocessing library testpack-2.1.1...
[1 of 3] Compiling Test.QuickCheck.Instances ( src/Test/QuickCheck/Instances.hs, dist/build/Test/QuickCheck/Instances.o )
src/Test/QuickCheck/Instances.hs:50:10:
Duplicate instance declarations:
instance Random Word8
-- Defined at src/Test/QuickCheck/Instances.hs:50:10
instance Random Word8 -- Defined in `System.Random'
cabal: Error: some packages failed to install:
testpack-2.1.1 failed during the building phase. The exception was:
ExitFailure 1
I've tried Googling, but cannot make sense of this install error.
testpack-2.1.1 provides a so called orphan instance for Random Word8, that is, an instance where it doesn't define either the class or the type itself.
One of the several problems with orphan instances is that one of the packages which do define the class or type might choose to add that instance themselves in a later version, which is precisely what the random package has done in this case, and so the instances conflict.
From testpack version 2.1.2 there is a check that makes sure to only define the instance if the random package is too old to have done so itself. So you should be able to fix this by installing a later version of testpack instead.

attoparsec Illegal equational constraint

as of the time of this writing, I'm running the newest GHC (7.9.20140608) and cabal (1.20.0.0), and it seems that attoparsec is failing.
Data/Attoparsec/ByteString/Internal.hs:519:7:
Illegal equational constraint a_audv ~ (ByteString, t)
(Use GADTs or TypeFamilies to permit this)
In the context: (a_audv ~ (ByteString, t))
While checking the inferred type for ‘succ'’
In the expression:
let
succ' t' pos' more' a
= succ t' pos' more' (substring pos (pos' - pos) t', a)
in runParser p t pos more lose succ'
In the second argument of ‘($)’, namely
‘\ t pos more lose succ
-> let succ' t' pos' more' a = ...
in runParser p t pos more lose succ'’
Am I missing any language extensions? Or would this issue be a little more tricky? Here is my cabal file: http://lpaste.net/105329
Any help with this would be incredible :) Happy Hacking!
For now, the best way to use ghc-7.8 (if your distro package manager doesn't include it) is to go to the ghc download page and follow the directions for the current stable release. There are binary packages, or you can install from source (with a source tarball, this can be as simple as ./configure && make && make install, but you'll need to have a working ghc already).
If you do install from source, you might consider changing the version, e.g. to 7.8.2.1. You can do this by editing the AC_INIT line in configure.ac then executing autoreconf before configure. If you do this, and also install to a version-specific location (e.g. /usr/local/ghc/ghc-7.8.2.1.src, this can be set via ./configure --PREFIX=/path/to/install), you'll be able to have your locally-compiled version installed concurrently with the packaged installation (or platform, or any other versions).
Be advised that ghc-7.8.3 is due out shortly (probably within two weeks at most); it's a bugfix release. Also there is currently no Haskell Platform release that includes ghc-7.8, so that's not an option at this time.

Cabal error for llvm-general

Trying to install llvm-general-3.3.5.
Have a local ghc-7.6.3 installation so used the following command to configure the llvm-general package after downloading the binary:
runhaskell Setup configure --user --/path/to/local --with-compiler=7.6.3
as is suggested in the haskell.org pages here.
That gets this error:
Setup.hs:42:13:
Couldn't match expected type `ProgramSearchPath
-> IO (Maybe FilePath)'
with actual type `IO (Maybe FilePath)'
In the return type of a call of `findJustBy'
Probable cause: `findJustBy' is applied to too many arguments
In the expression:
findJustBy (findProgramLocation v) llvmConfigNames
In the expression:
\ v -> findJustBy (findProgramLocation v) llvmConfigNames
Removing the configure options gets the same result.
Any ideas?
I'm on a Scientific linux machine.
Thank you!

Resources