Debian に yesod を入れる
使っているマシンがsqueezeでghcのバージョンが古くてcabalがエラーを吐いたので、GHC7とHaskell-Platformのソースをダウンロードする。
http://www.haskell.org/ghc/download_ghc_7_0_4
http://hackage.haskell.org/platform/linux.html
まずHaskell Platformのページを見てGHCのバージョンを合わせる。
必要なlibglut3-devパッケージも入れる。
http://haskell.g.hatena.ne.jp/udzura/20110926#1317034260
以下su省略。
tar xvjf ghc-7.0.4-x86_64-unknown-linux.tar.bz2 cd ghc-7.0.4/ ./configure make install cd .. tar xvzf haskell-platform-2011.4.0.0.tar.gz cd haskell-platform-2011.4.0.0/ ./configure make make install
yesodのインストールは
http://www.yesodweb.com/page/five-minutes
ここに書いてある通り。
~/.cabal/bin にPATHを通してから
cabal update cabal install Cabal cabal-install yesod
たぶんcabal installで自動的に入りそうだが関係ライブラリを入れておく。
http://www.sampou.org/cgi-bin/haskell.cgi?Yesod%3aProgrammingEnvironment
cabal install persistent-sqlite aptitude install libpq-dev libpcre3-dev cabal install persistent-postgresql
この後適当なディレクトリで yesod init してプロジェクトを生成する。
データベースを作り、config/postgresql.yml を編集する。
yesod init cd project_dir vi config/postgresql.yml
依存ライブラリを入れてサーバー起動。
cabal install alex cabal install yesod devel
localhost:3000 でサーバーが立ち上がる。
試しに Handler/Root.hs を書き換えるとサーバーがリロードされた。
今日はここまで。
その他参考:
http://yannesposito.com/Scratch/en/blog/Yesod-tutorial-for-newbies/
http://bicycle1885.hatenablog.com/category/Haskell