I just wanted to point out that your code probably does not do what you think it does.

This pipeline:

    (yield input >~ return ExitSuccess) >-> toPipe

... is equivalent to:

    return ExitSuccess

The `yield input` and `toPipe` never get used.

If you can explain what you were trying to do I can show you how to encode your desired behavior.


On 10/7/2015 2:05 PM, Andrea Corradi wrote:
Hi all,

I want to interact with a process through its stdin/stdout;
the interaction is similar to the one with a server where
I send request via stdin and I get the response via stdout.

For this reason I was trying to use a producer and a consumer
to make a Server and compose it with a Client using +>>

Function that should make a Server:

serverProcess toPipe fromPipe input = do
(yield input >~ return ExitSuccess) >-> toPipe
r <- next fromPipe
case r of
   Left e -> return e
   Right (output,fromPipe') ->
     do input' <- respond output
        serverProcess toPipe fromPipe' input'

This function has type
serverProcess :: Monad m =>
   Proxy () b1 b1 c m ExitCode
   -> Producer c (Proxy a' a b1 c m) b -> b1 -> Proxy a' a b1 c m b

and is not usable as I wanted. Unfortunately I could not come up with
a solution.

I'm using pipes-cliff to open the process and get the Producer
and Consumer pipes.


Is there a way to make this work?
Is there a more idiomatic way to do this?

Thanks,
Andrea


--
You received this message because you are subscribed to the Google Groups "Haskell 
Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to