yesodとcabal sandbox
2015-07-03追記: 現在yesodを使いたい場合は、stackを導入するのが適切だと思います。
https://github.com/commercialhaskell/stack
cabal-install-1.18からsandbox機能が付き便利になったわけだが、いまいちyesodでsandbox機能をスマートに使う方法が見つからなかったのでメモ(というエントリを書いてからその方法が見つかると言うね。まあいいのだけど)。
なおGHC7.6.3, yesod-platform-1.2.7.1を前提としている。
どうでもいいがyesod-platform-1.2.6はyesod-bin-1.2.6で生成したファイル群で使えない悲しさがあった。そこバージョン合わせている訳じゃないのか。
yesod-platfromとは複雑な依存関係を持つyesodにおいてcabal-hellを回避するため、関連する全てのライブラリのバージョンを固定したパッケージである。
以下を見れば分かるが、全てのライブラリのバージョンが(==)で指定されている。
Snoymanは特別な理由がない限り、常にyesod-platformを使う事を薦めている。
ポイントは以下の三つだろうか。
- cabal sandbox initを初めに実行すること、
- yesod-platform yesod-binはcabal installで同時に入れること、
- yesod init --bareすること
cabal installの-jオプションは各自マシンのコア数指定してください。
$ mkdir yesod-test $ cd yesod-test $ cabal sandbox init $ cabal install yesod-platform yesod-bin --max-backjumps=-1 --reorder-goals -j2 $ .cabal-sandbox/bin/yesod init --bare $ cabal install -j2 $ yesod devel
とこのエントリを書いた訳だが、yesod-binで生成した後のコマンドが以前と何やら変わっている。
That's it! I'm creating your files now...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
___
{-) |\
[m,].-"-. /
[__][__] \(/\__/\)/
[__][__][__][__]~~~~ | |
[__][__][__][__] / |
[__][__][__][__][__]| /| |
[__][__][__][__][]| || | ~~~~
ejm [__][__][__][__][__]__,__, \__/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
The foundation for your web application has been built.
There are a lot of resources to help you use Yesod.
Start with the book: http://www.yesodweb.com/book
Take part in the community: http://yesodweb.com/page/community
Start your project:
cd yesod-test && cabal sandbox init && cabal install --enable-tests . yesod-platform yesod-bin --max-backjumps=-1 --reorder-goals && yesod devel
以前cabal-devを使ったコマンドが此処に書いてあった訳だけど、cabal sandboxに変わっている。
ということでこの最後の行のコマンドをそのまま実行したら今は問題なく動かせるかもしれない。ただこのコマンドはyesod-binでインストールしたyesodのinit後に表示されるのでもっと早く教えて上げるべきじゃないかなあと思う訳だ。