我如何 运行 在 cabal 沙盒中搭建 Yesod 网站?

How can I run a scaffolded Yesod website in a cabal sandbox?

假设我在文件夹 root 中有一个 cabal 沙箱,并且我已经在其中安装了 yesod 包。然后,我做:

root> yesod init

我根据提示在 root 中找到了一个文件夹 project

yesod devel 似乎不支持将沙箱参数传递给它,因此我在沙箱中安装的任何软件包对脚手架 Yesod 站点都是不可见的(而且我不想在全局 space,因为这是不可能管理和复制的)。

我已经尝试过 the suggestion here,但是这给了我这些错误:

root> runhaskell -no-user-package-db -package-db=.cabal-sandbox\x86_64-windows-ghc-7.8.4-packages.conf.d project/app/main.hs

project\app\main.hs:2:8:
  Could not find module `Application'
  Use -v to see a list of the files searched for.

运行里面root/project:

root/project> runhaskell -no-user-package-db -package-db=../.cabal-sandbox\x86_64-windows-ghc-7.8.4-packages.conf.d app/main.hs

Foundation.hs:6:8:
  Could not find module `Text.Jasmine'
  Use -v to see a list of the files searched for.

Settings.hs:8:8:
  Could not find module `ClassyPrelude.Yesod'
  Use -v to see a list of the files searched for.

Settings.hs:14:8:
  Could not find module `Database.Persist.Sqlite'
  Perhaps you meant
    Database.Persist.Sql (from persistent-2.1.2)
    Database.Persist.Sql.Util (from persistent-2.1.2)
    Database.Persist.Class (from persistent-2.1.2)
  Use -v to see a list of the files searched for.

Settings\StaticFiles.hs:4:8:
  Could not find module `Yesod.Static'
  Use -v to see a list of the files searched for.

有谁知道我可以设置的标志之类的吗?

这应该有效:

只需初始化一个沙箱,您就可以在其中搭建网站

cabal sandbox init --sandbox=[path to yesod-sandbox]

或者只是初始化一个新的沙箱

cabal sandbox init 
cabal install --dependencies-only

脚本

甚至还有一个脚本 written by KrdLab 使用 stackage:

自动执行此操作
wget http://www.stackage.org/lts/cabal.config
cabal update
cabal sandbox init
cabal install alex happy yesod-bin
export PATH=./.cabal-sandbox/bin:$PATH
yesod init --bare
cabal install -j --enable-tests --max-backjumps=-1 --reorder-goals
yesod devel