39

I've been trying out cabal head which has support for sandboxes similar to cabal-dev. However there's not yet support for a cabal-dev ghci equivalent and apparently no support planned for the next release.

Is there some incantation I can use to work around this and get something similar to cabal-dev ghci?

Mikhail Glushenkov
  • 14,928
  • 3
  • 52
  • 65
jberryman
  • 16,334
  • 5
  • 42
  • 83
  • 2
    Unfortunately, right now there is no easy-to-use analogue to `cabal-dev ghci`. Duncan plans to merge Sam Anklesaria's GSoC 2011 patches implementing `cabal repl` at some point (he has already merged some preparatory work), but ATM they are not in HEAD. Once `cabal repl` is implemented, sandboxes will also support it. – Mikhail Glushenkov Jun 09 '13 at 22:57
  • Thanks for the info! I would also accept difficult-to-use solutions. – jberryman Jun 10 '13 at 01:12

1 Answers1

40

edit (August 2013): The cabal repl patches have recently been merged. This functionality will be a part of the next release.


As of this writing, there is no easy-to-use analogue to cabal-dev ghci. We plan to add a cabal repl command in the future - however, at the moment this functionality is not in Cabal HEAD.

In the meantime, you can try the following workaround:

$ cd $YOUR_PACKAGE_DIR

# For GHC >= 7.6
$ ghci -no-user-package-db -package-db .cabal-sandbox/i386-linux-ghc-7.6.1-packages.conf.d

# For GHC < 7.6
$ ghci -no-user-package-conf -package-conf .cabal-sandbox/i386-linux-ghc-7.4.2-packages.conf.d

This won't make the modules of your package immediately available from ghci - you will have to load them with :l or import (which can break in the presence of custom preprocessors and CPP).

Mikhail Glushenkov
  • 14,928
  • 3
  • 52
  • 65
  • 7
    Note that `cabal repl` is available starting with cabal version 1.18: http://coldwa.st/e/blog/2013-08-21-Cabal-1-18.html That means when you have cabal version >= 1.18 you can just type `cabal repl` in your project directory and the sandbox will be used if avaialable. – Sven Koschnicke Feb 03 '14 at 10:08
  • Also, just a heads up that the i386-linux... is specific to your OS and ghc version - I have a different ghc version and OS so I had to enter a different prefix for my conf.d file. This may be obvious for everyone else, but I'm new to Haskell. – Matt McNaughton Dec 17 '14 at 01:51