How do I install my own package-candidate with cabal? - haskell

I've just created a new cabal package (http://hackage.haskell.org/package/json-python-0.1.0.0/candidate). I'd like to test it on a separate computer before publishing. Running cabal install json-python fails to find the candidate, which makes sense. Is there a way to tell cabal to target candidates, or a specific url of the tarball? Otherwise, is the best way to install the package to wget the tarball url from my other computer, run tar xf, and then cabal install from the local package? It would be great if someone could add some of this information to the otherwise nice introduction at http://hackage.haskell.org/upload.

These days you can use cabal.project and specify a remote tarball, e.g.
packages:
.
http://hackage.haskell.org/package/json-python-0.1.0.0/candidate/json-python-0.1.0.0.tar.gz

Related

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

How to manually install package to a project that uses cabal

I was hoping to use a library that is on Hackage. But it turns out that the maintainer of the package has abandoned the library for some time and now it's not compiling due to minor problems. Now that I fixed the problems, what is the best way to link it with my cabal project until my PR is merged into the upstream
To install it like "cabal install ..." would install it, try this:
Use "cabal get pkgname-X.Y.Z" to get the source from Hackage; it places the source in the directory pkgname-X.Y.Z
cd into the source directory and apply your patches
Run cabal install
There are other options if you are using stack or cabal sandboxes.

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 fetch dependencies for current package

I wrote a package that I am trying to build. For reasons, I do not want to install it on my laptop. I want to download all of its dependencies and install it on another computer. How can I do that? If I run
$ cd my-package
$ cabal fetch .
cabal says no packages requested. If I do
$ cabal fetch my-package.cabal
it does read the cabal file, but then it actually tries to download packages that don't exist on hackage, but are in my sandbox.
You could try this:
cabal fetch `cabal install --dependencies-only --dry-run | sed 1,2d`
You might want to do it in a fresh sandbox so it doesn't skip dependencies that are already installed.
Aren't *nix tools great?

How do you install packages/libraries without Cabal or Cabal-Install?

I'm trying to set up Haskell from scratch, on Ubuntu 11.04, without using the outdated Debian repository or Haskell-Platform.
I've installed GHC-7.0.4 from source with no problem, and now need to install Cabal (which appears to already be included in GHC in /usr/local/lib/ghc-7.0.4/Cabal-1.10.2.0) and Cabal Install.
The latter specifies several dependencies (parsec and network), each of which has several dependencies of their own (mtl, text, etc).
What's the command to install these packages, that I downloaded from hackage in tar.gz form?
Unpack, then runhaskell doesn't work.
I see Setup.lhs, but it's not clear what that's for or how to use it.
Most of the Haskell documentation I've found assumes you've installed from a repo or Haskell-Package and doesn't really explain this well.
cabal-install has a shell script that does this. If you download it from hackage and install it, you can start bootstrap.sh to install cabal-install. You can then use it to install other packages.
There are two different packages: Cabal and cabal-install. Cabal is a library, and cabal-install is an executable named cabal.
To install a package, cabal-install is an optional convenience wrapper around Cabal, but Cabal is required.
According to http://hackage.haskell.org/trac/ghc/wiki/Commentary/Libraries , Cabal is a 'zero-boot' package, so when you build GHC, Cabal and its dependencies are built for you automatically.
You can use ghc-pkg executable to check which packages are already installed:
# ghc-pkg list
Check if Cabal is in the list after you build GHC. If yes, you can install more packages without cabal-install using this documentation:
http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
I suggest you to install cabal-install first, and then install everything else using cabal-install executable. A usual commandine for global installation is this:
# runhaskell Setup configure
# runhaskell Setup build
# sudo runhaskell Setup install
Unpack a package tarball and run the commands in the folder with Setup.hs or Setup.lhs files. Note that a per-user non-root installation is also supported - Use runhaskell Setup configure --user
When you install cabal executable and its dependencies this way, use cabal install {package-name} to install more packages.
Note that Haskell Platform exists mostly because of the pain of installing cabal-install by yourself.

Resources