The code is here:

https://github.com/PierreR/pipes-zmq4/blob/master/sub.hs

This is just a learning process so please do not hesitate to comment.

Thanks,


On Thursday, December 19, 2013 9:24:07 PM UTC+1, Pierre R wrote:
>
> This is actually getting easier with the new API:
>         loop = do
>             records <- draw10
>             let (avgTemp, avgHumidity) = L.fold averages records
>             liftIO $  printf "-- Report: average temperature is %d°C, 
> average humidity is %d%% \n" avgTemp avgHumidity
>             eof <- PP.isEndOfInput
>             unless eof loop 
>
> Cheers,
>
> On Wednesday, December 18, 2013 9:29:32 PM UTC+1, Pierre R wrote:
>>
>> Hi,
>>
>> I am having a go with the new parsing API (just for learning purposes). 
>> How should I convert the following code ?
>>
>> (avgTemp, avgHum) <- fold' averages (input >-> P.take 10)
>>
>>
>> https://github.com/PierreR/pipes-zmq3/blob/master/sub.hs#L66
>>
>> Do I replace (input >-> P.take 10) with zoom (splitAt 10) drawAll ? Then 
>> how do I use the parser with Foldl ?
>>
>> As a note, it seems to me that I don't need to check for stream 
>> termination with zeromq because I always get one message or nothing at all. 
>> The haskell zeromq lib takes care of dealing with error conditions already.
>> Is that right ?
>>
>> Thanks for your help,
>>
>> Cheers
>>
>>

-- 
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 [email protected].
To post to this group, send email to [email protected].

Reply via email to