3

I've just started using both cabal sandboxes and Fay. However, Fay seems unable to find the packages automatically, presumably as they are not in the 'global' cabal package database. I tried unsuccessfully to follow the advice on this wiki page, which to me looked like:

./cabal-sandbox/bin/fay.exe --base-path .cabal-sandbox/i386-windows-ghc-7.6.3/fay-base-0.19/src/ Frontend.hs

But Fay still complains it cannot find package fay-base. Is there something I can do about this, or must I install Fay outside the sandbox?

Daniel Buckmaster
  • 7,108
  • 6
  • 39
  • 57
  • Just yesterday I found myself in the same situation :) https://github.com/faylang/fay/wiki/Installing-and-running states that you just have to set `HASKELL_PACKAGE_SANDBOX` to your `packages.conf` but I haven't gotten that to work with cabals sandboxing ... – fho Feb 27 '14 at 13:45
  • I swear I didn't even see the section of the wiki page that mentions sandboxes :P. – Daniel Buckmaster Feb 27 '14 at 20:09
  • Yep ... I had to search for it too ... and it took a while :) – fho Feb 28 '14 at 09:52
  • I added a note that this page contains sandbox instructions as well, hopefully people will be able to find it easier now! – Adam Bergmark Feb 28 '14 at 14:34

1 Answers1

4

You don't need to supply the base path, but you need to point it to the correct package config by passing --package-conf or setting the HASKELL_PACKAGE_SANDBOX environment variable.

For instance:

./.cabal-sandbox/bin/fay --package-conf=.cabal-sandbox/x86_64-osx-ghc-7.6.3-packages.conf.d examples/alert.hs

or

HASKELL_PACKAGE_SANDBOX=./.cabal-sandbox/x86_64-osx-ghc-7.6.3-packages.conf.d ./.cabal-sandbox/bin/fay examples/alert.hs

More information is available at https://github.com/faylang/fay/wiki/Installing-and-running#wiki-sandboxes (I just edited it to make it a bit clearer, and I'll add a link from the other wiki page)

Adam Bergmark
  • 7,316
  • 3
  • 20
  • 23
  • Thanks heaps! I don't think I found that wiki page in my search :P. I got it working with the `--package-conf` option. – Daniel Buckmaster Feb 27 '14 at 20:10
  • @AdamBergmark could you please confirm that this actually works with the `HASKELL_PACKAGE_CONFIG` envvar? I am sure that I set that to the `.conf.d` directory and still got the `cannot find package` error. – fho Feb 28 '14 at 09:54
  • Oh sorry that was a typo, it's supposed to be `HASKELL_PACKAGE_SANDBOX`. I'll edit my answer. – Adam Bergmark Feb 28 '14 at 14:29
  • Eh yep ... I overread your typo :) ... could you confirm that this actually works for cabals buildin sandboxes? – fho Mar 04 '14 at 13:15
  • It does, I ran that command before adding it to the answer, what error are you getting? – Adam Bergmark Mar 04 '14 at 17:07