Update Dec 2017: Dear reader, this post was written in a time when Stack did not exist and Haskell users had to deal with cabal directly. For most intents and purposes, you will have a much better experience using Stack.
That being said, the content of this post should still be valid.
This was a finding from me trying out the Yesod Web Framework and reading the book here.
I installed yesod in a sandbox (located at
/home/yh/yesod), by executing the following commands from
mkdir yesod cd yesod cabal sandbox init cabal update cabal install yesod cabal install yesod-bin
After that, I prepended
$PATH, cd back to
$HOME, and ran:
I named the project
yesod init created a directory named
yosog, located at
$HOME/yosog. Essentially, the
yesod binary (installed above through
cabal install yesod-bin) provides a scaffolding for developing web applications using yesod. More details can be found here.
Thereafter, I proceeded to type this example and save it into
$HOME/yosog/helloworld.hs, and ran:
only to get:
helloworld.hs:5:8: Could not find module `Yesod' Use -v to see a list of the files searched for.
But, yesod was obviously installed earlier at
$HOME/yesod. I just needed a way to make use of it…
After some googling, I ran into the following stack overflow question
And proceeded to run:
runhaskell -package-conf=$HOME/yesod/.cabal-sandbox/x86_64-linux-ghc-7.4.1-packages.conf.d helloworld.hs
And voila! The program ran!