I'm using sandboxes all the time when building Haskell programs and libraries. But occasionally, I build a program that I would like to install system wide. There doesn't seem to be an easy way of taking a program which is built in a sandbox and installing it outside of the sandbox.
2 Answers
Linking Idris to a PATH-folder
If you are on linux it's as simple as putting a symbolic link somewhere into your path - I have a ~/bin
for that. So it's the same as bheklilr mentioned only that I usually get the dev-version from github:
git clone git://github.com/idris-lang/Idris-dev idris
cd idris
cabal sandbox init
cabal update
cabal install --dependencies only
make
after this I go to ~/bin
and use ln -s [path to idris]/.cabal-sandbox/bin/idris
- you can link the other executables too if you like but this one will should be enough to play with idris

- 4,009
- 1
- 24
- 32

- 51,810
- 9
- 92
- 119
-
Thanks. That's a very simple and pragmatic solution. Though I still wish cabal provided a means to solve the problem. – svenningsson May 31 '15 at 07:25
If the binary is statically linked (which is true in most cases) then you can do the following
> mkdir tools
> cd tools
> cabal sandbox init
> cabal install tool1 tool2
# Wait a long time
> cp .cabal-sandbox/bin/tool1 ~/.cabal/bin
> cp .cabal-sandbox/bin/tool2 ~/.cabal/bin
On windows you'll have to do
> cp .cabal-sandbox\bin\tool1.exe %APPDATA%\Roaming\cabal\bin
> cp .cabal-sandbox\bin\tool2.exe %APPDATA%\Roaming\cabal\bin
Obviously you should have your user cabal directory on your path.
Your mileage may vary, it's dependent on the executable being built, so for some it might be more difficult to do this sort of thing. In my experience this works pretty well, though. I use it for ghc-mod, hlint, pointfree, and others.

- 53,530
- 6
- 107
- 163
-
1The program I currently want to install is idris which comes with a ton of extra stuff like libraries. I'd like to avoid having to figure out how to copy all that data by hand. – svenningsson May 30 '15 at 12:48