[Haskell-cafe] streaming translation using monads

Warren Harris warrensomebody at gmail.com
Wed Nov 19 12:59:22 EST 2008


On Nov 18, 2008, at 6:53 PM, Brandon S. Allbery KF8NH wrote:

> On 2008 Nov 18, at 21:23, Warren Harris wrote:
>> However, each of the clauses is actually an output routine to send  
>> the expression that it denotes to a remote server, and a parser for  
>> receiving the results. Since a clause is really a pair of  
>> operations, it doesn't seem possible to formulate a monad that will  
>> compose all the output routines together and compose all the input  
>> routines together in one shot. (Note that the variables in the  
>> above code (v1, v2) represent inputs to be received from the remote  
>> server -- all outputs are packaged into the clause expressions  
>> themselves and are effectively literals.)
>
>
> Have you considered using arrows instead?

I'm not that familiar with arrows, but have just looked at some papers  
by Hughes and Paterson. It appears that unlike monads, the right-hand  
side of the arrow operator is not a function, and as such could be  
used to define a pairwise stream sequencing operator for my particular  
case. Are there any specific references that show something like this,  
e.g. for implementing network protocols? (I'm still trying to get my  
head around the basics of arrows.) Thanks,

Warren


More information about the Haskell-Cafe mailing list