Skip to content

Installing and running

bergmark edited this page Oct 25, 2014 · 11 revisions

To install:

$ cabal install fay fay-base

Or clone with git:

$ cabal get -s fay
$ cd fay
$ cabal install . fay-base/

To run tests from within this directory (you need nodejs installed):

$ fay-tests

Try it out (make sure you have fay-base installed, or you'll get an error):

$ fay examples/console.hs
$ node examples/console.js

Cabal-dev and cabal sandboxes also work

$ cabal-dev install
-- or
$ cabal-sandbox init; cabal install

Given that sandboxes are installed in a separate location, you'll wanna install fay-base in the same way:

$ cabal-dev install fay-base
-- or
$ cabal install fay-base

Then run the normal stuff:

$ HASKELL_PACKAGE_SANDBOX=.cabal-sandbox/X.conf.d .cabal-sandbox/bin/fay-tests

$ cabal-dev/bin/fay --package-conf=.cabal-dev/X.conf.d examples/console.hs
$ node examples/console.js


If you only installed in a cabal sandbox or with cabal-dev then you will probably get a ghc-pkg: cannot find package fay-base error from GHC, so you can tell it where to get the package from with an environment variable:

HASKELL_PACKAGE_SANDBOX=cabal-dev/packages-7.4.1.conf ./.cabal-sandbox/bin/fay examples/alert.hs

or by using a flag:

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

This also lets the compiler find other packages supplied with the --package flag.

You must have fay, fay-base, and other Fay packages installed in the same location in order to use --package, Fay can only find packages in the same package database as it was installed.

When using the API you can either set configPackageConf manually or use the environment variable and get the config with defaultConfigWithSandbox.


fay-base contains Fay's standard library and is needed in order to use the compiler.

You can’t perform that action at this time.