installing reactive-banana-wx - haskell

when you try to install the library reactie-banana-wx, get the error:
src\CRUD.hs:10:18: Could not find module `Data.Map': It is a member of the hidden package `containers-0.4.0.0'. Perhaps you need to add `containers' to the build-depends in your .cabal file.
installed the command:
cabal install reactive-banana-wx
Please help correct the problem.

The advice it offers is sound, if a bit confusing: cabal install hides the step where it produces the .cabal file! Here's how you can do that part explicitly:
cabal unpack reactive-banana-wx
cd reactive-banana-wx-*
gvim *.cabal # or whatever editor you prefer
# follow the instructions given in the error
cabal install

Related

Can't install "System.Random" by cabal

I try to install "System.Random" by cabal through Powershell & Git Bash.
getting this result.
PS C:\Users\xxx> cabal install random
Resolving dependencies...
Up to date
Warning: You asked to install executables, but there are no executables in
target: random. Perhaps you want to use --lib to install libraries instead.
And then I try to input like this
cabal install --lib random
Resolving dependencies...
and
cabal install random --lib
both output Resolving dependencies... Up to date without warning.
but ghci Could not find module `System.Random'
input cabal install random still having the same result with warning.
It is a bad idea to install packages globally, so cabal install doesn't do that. The package is built and placed into the Cabal package database, but GHC won't find it unless you specifically tell Cabal to point GHC at it:
cabal repl -b random # -b is short for --build-depends
# Note that cabal install isn't really necessary: the above command would have installed random if it wasn't there already
I think your Cabal/GHC installation might be outdated, however. When you do cabal install --lib random, recent versions of Cabal should write out an "environment file" at %APPDATA%\ghc\arch-os-ghcversion\environments\default, which GHC should then automatically read (GHCi should say something like Loaded package environment from ...), and it should then find the installed package. If you are using the latest version of everything,
cabal install --lib random
ghci
should work.

Cabal install command Gives error

I can't understand why it just dosen't work. My question is what might have gone wrong i have created the ~/.bash_profile and tried to add the PATH given by the haskell webpage.
When i preform cabal install i get this output:
Marcuss-MacBook-Pro:~ marcuslagerstedt$ cabal install
cabal: Error reading local package.
Couldn't find .cabal file in: .
Marcuss-MacBook-Pro:~ marcuslagerstedt$
I hope i did a correct question.
But i really need help aswell.
You seem to be wanting to install a particular package, namely agda. The command cabal install takes either the name of a package or assumes you are installing some package in the local directory. You are hitting this second case.
To install agda try:
cabal update
cabal install agda

Installing `ghc-mod` with Cabal

cabal install ghc-mod seems to work, but when I try cabal run ghc-mod I get the following error:
Package has never been configured. Configuring with default flags. If this fails, please configure manually.
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal
The resources I've found seem to suggest that creating a package description file shouldn't be necessary to install a package.
Any ideas?
The standard way to install stuff on Haskell nowadays is within sandboxes.
Go to the terminal and create an empty folder that will house your ghc-mod sandbox. cd into that folder and:
cabal sandbox init
cabal install ghc-mod
After it finishes you will find the ghc-mod binary you seek within .cabal-sandbox/bin. Since it's statically linked it's safe to move it to somewhere in your $PATH.
I strongly encourage you use a sandbox but if you don't want to go to .cabal in your home directory and you will find the binary with bin

"cabal install cabal-install" doesn't update cabal version in OSX

I'm a newbie to haskell and cabal, so I'm probably missing something simple.
I updated cabal-install:
sudo cabal install cabal-install
Password:
Resolving dependencies...
Configuring cabal-install-1.22.0.0...
Building cabal-install-1.22.0.0...
Installed cabal-install-1.22.0.0
Updating documentation index
However cabal --version says:
cabal-install version 1.18.0.5
using version 1.18.1.4 of the Cabal library
What happened to cabal-install 1.22.0.0?
There are two ways of making cabal install packages globally. Note that, as a result, cabal may require sudo.
This command will install <PACKAGE> globally:
$ cabal install <PACKAGE> --global
As a more general solution, edit the file ~/.cabal/config and set user-install to False. This will automatically set the --global flag so you can just write cabal install <PACKAGE> without any worry. Here's a snippet of my config file:
...
-- split-objs: False
-- executable-stripping: True
user-install: False
-- package-db:
-- flags:
...
You may also want to set root-cmd to sudo if it's not already, so that cabal will automatically prompt for the root password when it encounters a permission problem.
There's some more info online here.
I see that there's an updated cabal at ~/Library/Haskell/bin, so I could replace /usr/bin/cabal with a symbolic link to this copy or I could copy this binary to /usr/bin.
I'm still interested if there is a more elegant/canonical way to make sure the new cabal is what gets used by default.
TLDR: Try running hash -r
Bash has a PATH hashtable that maps commands to the location of binaries. You may still have an old version of cabal installed somewhere in your PATH (possibly in a sandbox). Since cabal is not a new command, the hashtable will keep serving up the old version. hash -r rebuilds the hashtable, so the shell will correctly find the new version (providing it appears earlier in your path than the old one).

Cabal install reports package as installed, but Setup configure reports it as missing

I am using ghc-7.6.3 with cabal-install version 1.18.0.5 using version 1.18.1.3 of the Cabal library. My operating system is Debian Wheezy 7.5.
I have a fresh cabal install, and that I have removed the .ghc from my home directory.
After that I have changed the cabal config file and set:
remote-repo: stackage-nightly-2014-12-15:http://www.stackage.org/snapshot/nightly-2014-12-15
After that I did (following this documentation)
$ cabal update
$ cabal install alex happy yesod-bin
and the build complained that it cannot build package system-filepath-0.4.12.
So, I am trying to build package system-filepath-0.4.12 manually. After unpacking the archive, I cd-ed to the unpacked folder and entered:
$ ghc -o Setup Setup.hs
$ ./Setup configure
which gives:
Configuring system-filepath-0.4.12...
Setup: At least the following dependencies are missing:
text >=0.7.1
But
$ cabal install text
gives:
Resolving dependencies...
All the requested packages are already installed:
text-1.1.1.3
Use --reinstall if you want to reinstall anyway.
How is it possible that a package is reported as installed and missing at the same time?
Should I look for a more stable remote-repo configuration, is there something I can check that might fix the missing text package? Note that I am not using a sandbox.
EDIT
Thanks for pointing out that there are two package databases.
I have now tried both
$ cabal configure
$ cabal build
and
$ Setup configure --user
$ Setup build
Both give no error during configuration, but give the following error during the build phase:
Building system-filepath-0.4.12...
Preprocessing library system-filepath-0.4.12...
/usr/bin/ld: cannot find -lHStext-1.1.1.3-ghc7.8.3
collect2: error: ld returned 1 exit status
Try this instead
cd system-filepath--0.4.12
cabal configure
I am not sure why, but this works for me, whereas Setup.hs gave me the same error (truth be told, I always do it the cabal configure way, and am not sure if your way should also work).
There are (at least) two package databases: a global one available to all users, and a user-specific one. By default, Setup.hs looks in (and installs to) the global one, and cabal-install looks in (and installs to) the user-specific one. You can manually choose one or the other with --user and --global; so, you could fix this either by using
./Setup configure --user
or by
cabal install text --global
You can see the current state of the package databases with ghc-pkg, which will report information about both by default.

Resources