Ah, I should have realised *Stream ((->) (Feed a))* can be used for then 
iteratee part!

I think I will use your implementation with the constructors exposed, after 
I understand it better and add a few tests.

In the `Streaming.Prelude` module there is the dubious `store` function 
>
>       store :: Monad m => (Stream (Of a) (Stream (Of a) m) r -> t) -> 
> Stream (Of a) m r -> t
>
>       store f str = f (copy str)
>
>
>
> This is meant to be used at types like 
>
>
>         
>
>       S.store    :: Monad m => EvertibleM m a b -> Stream (Of a) m r -> 
> Stream 
> (Of a) m (Of b r)
>
>       S.store    :: Monad m => Evertible a b -> Stream (Of a) m r -> Stream 
> (Of a) m (Of b r)
>
> (taking `Evertible` and company as rank-2 type synonyms, not newtypes). 
>  The idea was to permit  you to apply more than one eliminating operation to 
> the same stream of items. 
>
You apply a fold and still have your stream!
>

It seems somehow related to the applicative instance for Fold, that lets 
you consume a stream in two different ways...
 

> I just ended up exporting the equivalent of my `evertMaster` above with 
> some comments on use. I'm not sure there would be any harm by the way in 
> exporting three functions corresponding to `evert(M(IO))` that just take 
> the rank two functions directly. I wasn't having trouble with the 'raw'
>
>
I remember having problems about GHC complaining and telling me to enable 
ImpredicativeTypes but, come to think of it, perhaps it was only with 
TransvertibleM.
 

>  I still haven't got to figuring out the `Transvertible` bit!
>
>
I think that, if you use unseparate 
<http://hackage.haskell.org/package/streaming-0.1.4.3/docs/Streaming.html#v:unseparate>on
 
cat, you get a stream that, when inspected, alternatively emits output (to 
be fed to the "inner" fold) and requests input. But I'm not sure how the 
efficient solution using the internal constructors would look like.

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