Bartek Ćwikłowski | 8 Nov 11:29 2011

ANN: virthualenv - Virtual Haskell Environment

I am pleased to announce the first public release of the virthualenv tool.

What is it?
virthualenv is a tool (inspired by Python's virtualenv) to create
isolated Haskell environments.

What does it do?
It creates a sandboxed environment in a .virthualenv/ sub-directory of
your project,
which, when activated, allows you to use regular Haskell tools (ghc,
ghci, ghc-pkg, cabal) to manage
your Haskell code and environment. It's possible to create an
environment, that uses different GHC version
than your currently installed. Very simple Emacs integration mode is included.

Basic usage
First, choose a directory where you want to keep your sandboxed
Haskell environment,
usually a good choice is a directory containing your cabalized project
(if you want to work on a few projects (perhaps an app and its
dependent library),
 just choose any of them, it doesn't really matter). Enter that directory:

>  cd ~/projects/foo

Next, create your new isolated Haskell environment (this is a one time
only (per environment) step):

>  virthualenv

Now, every time you want to use this environment, you have to activate it:

>  source .virthualenv/bin/activate

That's it! Now it's possible to use all regular Haskell tools like
usual, but it won't affect your
global/system's Haskell environment, and also your per-user environment
(from ~/.cabal and ~/.ghc) will stay the same. All cabal-installed
packages will be private
to this environment, and also the external environments (global and
user) will not affect it
 (this environment will only inherit very basic packages, mostly ghc
and Cabal and their deps).

When you're done working with this environment, enter command 'deactivate',
or just close the current shell (with exit).

> deactivate

More info
Blog post:

Bartosz Ćwikłowski