YesodをWindowsで動かしてみる件

すごいH本の写経の気分転換にHeskellのWebフレームワークであるYesodをインストールしてみた。
ハマるかなーと思いきやサクッと(最初のHelloページが)動いたので肩すかしでした。

YesodをWindowsにインストールして動かす日本語ブログは非常に少ないのでここに記す。
(ghci等はインストール済みを前提)

まずは http://www.yesodweb.com/page/quickstart の仰せの通り、「cabal update」。

PS C:\xxxx> cabal update
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install

yesodインストール。
Warningがかなり出るがとりあえず無視。。そして結構時間かかる。

PS C:\xxxx> cabal install yesod-platform
Resolving dependencies...
Downloading SHA-1.6.1...
Configuring SHA-1.6.1...
Building SHA-1.6.1...
Preprocessing library SHA-1.6.1...
[1 of 1] Compiling Data.Digest.Pure.SHA ( Data\Digest\Pure\SHA.hs, dist\build\Data\Digest\Pure\SHA.o )
Registering SHA-1.6.1...
Installing library in
C:\xxxxxxxxxxxx\AppData\Roaming\cabal\SHA-1.6.1\ghc-7.4.2
Registering SHA-1.6.1...
............

scaffolderでサイト作成。
DBとか何を使う?とか聞いてくるがとりあえずsimple。

PS C:\xxxx> yesod init
Welcome to the Yesod scaffolder.
I'm going to be creating a skeleton Yesod project for you.

What do you want to call your project? We'll use this for the cabal name.

Project name: YesdoTest
Yesod uses Persistent for its (you guessed it) persistence layer.
This tool will build in either SQLite or PostgreSQL or MongoDB support for you.
We recommend starting with SQLite: it has no dependencies.

    s      = sqlite
    p      = postgresql
    mongo  = mongodb
    mysql  = MySQL
    simple = no database, no auth
    url    = Let me specify URL containing a site (advanced)

So, what'll it be? simple
That's it! I'm creating your files now...

作成したサイトのフォルダが出来ているので入る。

PS C:\xxxx> cd .\YesdoTest

develで起動する。

PS C:\xxxx\YesdoTest> yesod devel
Yesod devel server. Press ENTER to quit
...................
Devel application launched: http://localhost:3000

この後、http://localhost:3000にアクセスするとHelloページが表示される。