Hi,

I have uploaded a small library to Hackage called streaming-eversion 
<http://hackage.haskell.org/package/streaming-eversion>. 

I was thinking the other day that it would be nice to be able use the 
various "non-lens decoding functions" from pipes-text 
<http://hackage.haskell.org/package/pipes-text-0.0.2.4/docs/Pipes-Text-Encoding.html>
 
directly on the Fold datatype from the foldl 
<http://hackage.haskell.org/package/foldl> package.

In general, I would like to take any pull-based transformation on 
streams/producers and apply it as a "transducer" that changes the inputs of 
a Fold.

So I implemented the technique described in the blog post Programmatic 
translation to iteratees from pull-based code 
<http://pchiusano.blogspot.com.es/2011/12/programmatic-translation-to-iteratees.html>
 
by Paul Chiusano, and it seems to work.

An example of applying a *pipes-text* decoding function to the inputs of a 
Fold:

    :{
    import qualified Control.Foldl as L
    import qualified Pipes.Text.Encoding as TE
    import Streaming.Eversion.Pipes

    let adapted = transvertM (pipeTransvertibleM (\producer -> 
pipeLeftoversE (TE.decodeUtf8 producer))) 
                             (L.generalize L.mconcat) 
    in  runExceptT $ L.foldM adapted ["decode","this"]
    :}
Right "decodethis"





-- 
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