Haskell – YESOD WAI-EventSource example. Package dependence?

I am trying to compile this sample code on my system.
When I tried to compile the chat module using ghc Chat.hs, ghc gave me:

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

I am on OS X Snow Leopard and cleaned up (everything?) Except for the Haskell platform, as follows:< /p>

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

And reinstall yesod and wai-eventsource from hackage.

As far as I know, the error comes from dependency issues.

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

where yesod-0.9.4.1 requires wai == 0.4.* and wai-eventsource-1.0.0 requires wai> = 1.0.< /p>

So, my question is: Is it possible to make this example (using the official version of yesod) work immediately? With all the changes, the yesod project is going through atm?
Do I have to be more precise about the version I am trying to install? If yes, how?

Edit:

I wiped out ~/.ghc (or actually followed the more strict method given here, just in case) and tried to install the package with a separate< br>Cabal installation of yesod wai-eventsource leads to (incomplete):

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

Before this (install yesod and wai-eventsource separately) I tried ghc -hide-package wai-1.0.0 Chat.hs,

< p>

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

I think You need to unregister (or hide) wai 1.0.0. The current Yesod is using wai 0.4, which is the source of the mismatch. (Once the updated Yesod is released, this problem will disappear.)

< p>Or, you can clear the ~/.ghc folder again and run cabal install yesod wai-eventsource, it should only automatically install the compatible version.

Edit: you need to hide the wai-eventsource, or it may be hidden Several others. The easiest way is to run ghc-pkg unregister wai-eventsource-1.0.0 --force.

I am trying to compile this example on my system Code.
When I tried to compile the chat module with ghc Chat.hs, ghc gave me:

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

I am on OS X Snow Leopard and cleaned up (everything? ) Except for the Haskell platform, as follows:

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

and reinstall yesod and wai-eventsource from hackage.

As far as I know, the error comes from dependency issues.

< pre>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

where yesod-0.9.4.1 requires wai == 0.4.* and wai-eventsource-1.0.0 requires wai> = 1.0.

So, my question is: Is it possible to make this example (using the official version of yesod) work immediately? With all the changes, the yesod project is going through atm?
Do I have to be more precise about the version I am trying to install? If yes, how?

Edit:

I wiped out ~/.ghc (or actually followed the more strict method given here, just in case) and tried to install the package with a separate< br>Cabal installation of yesod wai-eventsource leads to (incomplete):

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

Before this (install yesod and wai-eventsource separately) I tried 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

I think you need to unregister (or hide) wai 1.0.0. Currently Yesod is using wai 0.4, which is the source of the mismatch. (This problem will disappear once the updated Yesod is released.)

Or, you can clear the ~/.ghc folder again And run cabal install yesod wai-eventsource, it should only automatically install the compatible version.

Edit: you need to hide wai-eventsource, and possibly others. The easiest way is to run ghc-pkg unregister wai-eventsource-1.0.0 --force.

Leave a Comment

Your email address will not be published.