Skip to content

Instantly share code, notes, and snippets.

@funrep
Last active December 20, 2015 01:19
Show Gist options
  • Save funrep/6048707 to your computer and use it in GitHub Desktop.
Save funrep/6048707 to your computer and use it in GitHub Desktop.
-- 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.
- }
@funrep
Copy link
Author

funrep commented Jul 21, 2013

src/Tob.hs:9:20:
Couldn't match type [Char]' withX'
Expected type: Proxy X () () X IO r0
Actual type: Client String () IO r0
In the first argument of (>>~)', namelyclient'
In the second argument of ($)', namelyclient >>~ server'
In the expression: runEffect $ client >>~ server

src/Tob.hs:9:31:
Couldn't match type Proxy X () String () IO r1' withX -> Proxy () X () X IO r0'
Expected type: X -> Proxy () X () X IO r0
Actual type: Server String () IO r1
In the second argument of (>>~)', namelyserver'
In the second argument of ($)', namelyclient >>~ server'
In the expression: runEffect $ client >>~ server

src/Tob.hs:12:10:
Couldn't match type IO' withProxy 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' withIO'
Expected type: String -> IO a0
Actual type: String -> Proxy x'0 x0 a0 String m0 a0
In the second argument of (>>=)', namelyrespond'
In the second argument of ($)', namelygetLine >>= respond'
In the expression: forever $ getLine >>= respond

src/Tob.hs:15:10:
Couldn't match type ()' withX'
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 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment