Last active
December 20, 2015 01:19
-
-
Save funrep/6048707 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- NOTE: I'm using pipes 4.0 here. | |
module Main where | |
import Pipes | |
import qualified Pipes.Prelude as P | |
import Control.Monad (forever) | |
main = runEffect $ client >>~ server | |
client :: Client String () IO r | |
client = forever $ (lift getLine) >>= respond | |
server :: Server String () IO r | |
server = forever $ do | |
r <- request () | |
lift $ putStrLn r | |
{- | |
The reason why I don't use Producer and Consumer here is cause I later want to write an IRC bot, and then I'll need to be able to both request and respond on both the client and server function. | |
- } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
src/Tob.hs:9:20:
Couldn't match type
[Char]' with
X'Expected type: Proxy X () () X IO r0
Actual type: Client String () IO r0
In the first argument of
(>>~)', namely
client'In the second argument of
($)', namely
client >>~ server'In the expression: runEffect $ client >>~ server
src/Tob.hs:9:31:
Couldn't match type
Proxy X () String () IO r1' with
X -> Proxy () X () X IO r0'Expected type: X -> Proxy () X () X IO r0
Actual type: Server String () IO r1
In the second argument of
(>>~)', namely
server'In the second argument of
($)', namely
client >>~ server'In the expression: runEffect $ client >>~ server
src/Tob.hs:12:10:
Couldn't match type
IO' with
Proxy String () () X IO'Expected type: Client String () IO r
Actual type: IO r
In the expression: forever $ getLine >>= respond
In an equation for `client': client = forever $ getLine >>= respond
src/Tob.hs:12:32:
Couldn't match type
Proxy x'0 x0 a0 String m0' with
IO'Expected type: String -> IO a0
Actual type: String -> Proxy x'0 x0 a0 String m0 a0
In the second argument of
(>>=)', namely
respond'In the second argument of
($)', namely
getLine >>= respond'In the expression: forever $ getLine >>= respond
src/Tob.hs:15:10:
Couldn't match type
()' with
X'Expected type: Server String () IO r
Actual type: Proxy () String String () IO r
In the expression:
forever
$ do { r <- request ();
lift $ putStrLn r }
In an equation for `server':
server
= forever
$ do { r <- request ();
lift $ putStrLn r }