4

このサンプルコードを自分のシステムでコンパイルできるようにしようとしています。でチャットモジュールをコンパイルしようとするとghc Chat.hs、ghcは次のように表示します。

Chat.hs:76:39:
    Couldn't match expected type `Network.Wai.Request'
                with actual type `wai-0.4.3:Network.Wai.Request'
    In the second argument of `eventSourceApp', namely `req'
    In the second argument of `($)', namely `eventSourceApp chan req'
    In a stmt of a 'do' expression:
        res <- lift $ eventSourceApp chan req

私はOSXSnow Leopardを使用していて、次のようなHaskellプラットフォームを除いて(すべて?)クリーンアップしています。

rm -r ~/.cabal
rm -r ~/.ghc
rm -r ~/Library/Haskell

そして、ハッキングから新たにyesodとwai-eventsourceをインストールしました。

私が理解している限り、エラーは依存関係の問題に起因します。

    wai
    Synopsis: Web Application Interface.
    Default available version: 1.0.0
    Installed versions: 0.4.3, 1.0.0
    Homepage: https://github.com/yesodweb/wai
    License:  BSD3

yesod-0.9.4.1にはwai==0.4。*が必要であり、wai-eventsource-1.0.0にはwai>=1.0が必要です。

したがって、私の質問は次のようになります。この例(yesodの公式リリースを使用)を今すぐ機能させることは可能ですか?すべての変更で、yesodプロジェクトはatmを通過していますか?インストールしようとしているバージョンをより正確にする必要がありますか?もしそうなら、どのようにですか?


編集:

私は一掃し(または、念のため、ここ~/.ghcで示したより厳密なアプローチを実際に実行しました)、単一のパッケージをインストールしようとしましたが、 結果は(不完全)になりました:cabal install yesod wai-eventsource

Resolving dependencies...
cabal: cannot configure yesod-0.9.4.1. It requires wai ==0.4.* and warp ==0.4.*
For the dependency on wai ==0.4.* there are these packages: wai-0.4.0,
wai-0.4.1, wai-0.4.2 and wai-0.4.3. However none of them are available.
wai-0.4.0 was excluded because wai-eventsource-1.0.0 requires wai >=1.0
...
wai-0.4.3 was excluded because wai-eventsource-1.0.0 requires wai >=1.0
For the dependency on warp ==0.4.* there are these packages: warp-0.4.0,
warp-0.4.0.1, warp-0.4.1, warp-0.4.1.1, warp-0.4.1.2, warp-0.4.2, warp-0.4.3,
warp-0.4.3.1, warp-0.4.4, warp-0.4.5, warp-0.4.6, warp-0.4.6.1, warp-0.4.6.2
and warp-0.4.6.3. However none of them are available.
warp-0.4.0 was excluded because wai-eventsource-1.0.0 requires warp >=1.0
...
warp-0.4.6.3 was excluded because wai-eventsource-1.0.0 requires warp >=1.0

その前に(yesodとwai-eventsourceを別々にインストールして)ghc -hide-package wai-1.0.0 Chat.hs結果として、

Chat.hs:77:39:
Couldn't match expected type `wai-1.0.0:Network.Wai.Request'
            with actual type `Network.Wai.Request'
In the second argument of `eventSourceApp', namely `req'
In the second argument of `($)', namely `eventSourceApp chan req'
In a stmt of a 'do' expression:
    res <- lift $ eventSourceApp chan req
4

1 に答える 1

3

wai 1.0.0 を登録解除 (または非表示) する必要があると思います。現在の Yesod は wai 0.4 を使用しており、これがミスマッチの原因です。(より新しい Yesod がリリースされると、この問題はなくなります。)

または、 ~/.ghc フォルダーを再度消去して を実行することもできますcabal install yesod wai-eventsource。これにより、互換性のあるバージョンのみが自動的にインストールされます。

編集: wai-eventsource も非表示にする必要があります。最も簡単な方法は、実行することghc-pkg unregister wai-eventsource-1.0.0 --forceです。

于 2012-02-04T19:06:02.050 に答える