Haskell でウェブアプリのサンプルを作ってみる(失敗)
概要
Haskell で Yesod というものを使ってウェブアプリサンプルを作ってみる結論からいうと、だめでしたorz
強制改教手続き
神のインストール
まず、Windows で動く Haskell 環境を入手したいと思う。https://www.haskell.org/platform/windows.html
![]() |
洗脳され始める |
あ、
![]() |
劇物注入開始 |
![]() |
だんだん意識が朦朧としてくる |
![]() |
意識混濁 |
![]() |
Haskell |
神を使用する
hell world !-- Hell Haskell World !! main = do print "Hell Haskell World !"コンソール
"Hell Haskell World !"
え?ダブルクォーテーション消えないん?
外してみた
-- Hell Haskell World !! main = do print Hell Haskell World !結果
[1 of 1] Compiling Main ( h1.hs, h1.o ) h1.hs:4:1: parse error (possibly incorrect indentation or mismatched brackets)
あ?
なんじゃこりゃ。なんじゃこりゃ。大事なことなのでもう一度。
なんじゃこりゃ。
さて、落ち着こう。
Yesod の導入
PS R:\> cabal update Config file path source is default config file. Config file C:\Users\jskny\AppData\Roaming\cabal\config not found. Writing default configuration to C:\Users\jskny\AppData\Roaming\cabal\config 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 PS R:\> cabal install cabal-install Resolving dependencies... Downloading Cabal-1.22.0.0... Configuring Cabal-1.22.0.0... Building Cabal-1.22.0.0... Installed Cabal-1.22.0.0 Downloading cabal-install-1.22.0.0... Configuring cabal-install-1.22.0.0... Building cabal-install-1.22.0.0... Failed to install cabal-install-1.22.0.0 Last 10 lines of the build log ( C:\Users\jskny\AppData\Roaming\cabal\logs\cabal-install-1.22.0.0.log ): Installing executable(s) in C:\Users\jskny\AppData\Roaming\cabal\bin C:\bin\MinGW\bin\strip.exe:C:\Users\jskny\AppData\Roaming\cabal\bin\cabal.exe: File format not recognized cabal.exe: Error: some packages failed to install: cabal-install-1.22.0.0 failed during the final install step. The exception was: ExitFailure 1
ふぁ?
ふぁあああああああああ、あ゛あ゛あ゛あ゛あ゛あ゛あ゛
とりあえず、yesod だけをインストールしよう
PS R:\> cabal install yesod-platform Resolving dependencies... Downloading SHA-1.6.4.1... Downloading ansi-terminal-0.6.1.1... Downloading asn1-types-0.2.3... Configuring ansi-terminal-0.6.1.1... Downloading auto-update-0.1.0.0... Configuring asn1-types-0.2.3... Downloading base16-bytestring-0.1.1.6... Configuring SHA-1.6.4.1... Downloading base64-bytestring-1.0.0.1... Configuring auto-update-0.1.0.0... Downloading blaze-builder-0.3.3.2... Downloading byteable-0.1.1... Downloading byteorder-1.0.4... Downloading cereal-0.4.0.1... Building ansi-terminal-0.6.1.1... .......... Installed authenticate-1.3.2.10 Installed persistent-template-1.3.2.2 Downloading yesod-persistent-1.2.3... Configuring yesod-persistent-1.2.3... Installed esqueleto-1.4.4 Building yesod-persistent-1.2.3... Installed yesod-persistent-1.2.3 Downloading yesod-form-1.3.15.1... Configuring yesod-form-1.3.15.1... Building yesod-form-1.3.15.1... Installed yesod-form-1.3.15.1 Downloading yesod-auth-1.3.4.1... Configuring yesod-auth-1.3.4.1... Building yesod-auth-1.3.4.1... Installed yesod-auth-1.3.4.1 Downloading yesod-auth-hashdb-1.3.0.1... Configuring yesod-auth-hashdb-1.3.0.1... Building yesod-auth-hashdb-1.3.0.1... Installed yesod-auth-hashdb-1.3.0.1 cabal.exe: Error: some packages failed to install: hjsmin-0.1.4.7 failed during the building phase. The exception was: ExitFailure 1 hspec-1.11.0 failed during the final install step. The exception was: ExitFailure 1 wai-app-static-3.0.0 failed during the building phase. The exception was: ExitFailure 1 yaml-0.8.8.4 failed during the building phase. The exception was: ExitFailure 1 yesod-1.2.6.1 depends on yaml-0.8.8.4 which failed to install. yesod-platform-1.2.13.3 depends on wai-app-static-3.0.0 which failed to install. yesod-static-1.2.4 depends on wai-app-static-3.0.0 which failed to install. yesod-test-1.2.3.2 depends on hspec-1.11.0 which failed to install. PS R:\>
はい。エラーですね。
はいはい。もういいかな。
Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\jskny>yesod 'yesod' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 C:\Users\jskny>
はぁ・・・