runSafeConsumerT p = runSafeT $ runEffect $ hoist lift catFromLifted >-> p
runSafeProducerT p = runSafeT $ runEffect $ p >-> hoist lift catToLifted
runSafePipeT p = runSafeT $ runEffect $
hoist lift catFromLifted >-> p >-> hoist lift catToLifted
catFromLifted = go
where
go = do
x <- lift await
yield x
go
catToLifted = go
where
go = do
x <- await
lift $ yield x
go
main =
runEffect $ runSafeProducerT (readFile'' "input.dat") >-> loop 0
where
loop i = do
let fp = "out-pipes/" ++ show i
runSafeConsumerT $ P.take 50 >-> writeFile'' fp
loop $ i + 1
loop i = do let fp = "out-pipes/" ++ show i P.take 1 >-> runSafeConsumerT (P.take 50 >-> writeFile''' fp) loop $ i + 1
--
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-pipe...@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
Michael and I have been discussing a long-term solution for a `MonadCatch` class with resourcet-like behavior (i.e. `register` and `release`) that both libraries could share so in the long term that may be the better solution.
On Thu, Oct 10, 2013 at 10:45 PM, Gabriel Gonzalez <gabri...@gmail.com> wrote:
Michael and I have been discussing a long-term solution for a `MonadCatch` class with resourcet-like behavior (i.e. `register` and `release`) that both libraries could share so in the long term that may be the better solution.
Ideally I'd like two APIs here:
The main API which is basically SafeT
or ResourceT
plus a state index
An optional full-on indexed monad API with implicit region subtyping and all that juice
Is there any chance of making that work in a way that's decoupled from both pipes
and conduit
but also works with both?
--
--
On Thu, Oct 10, 2013 at 11:15 PM, Gabriel Gonzalez <gabri...@gmail.com> wrote:
However, if anybody is interested in joining in on those discussions just let me know and I will CC you all.
How about moving any private discussions to the streaming list?
Perhaps this could be solved by a new GHC extension, or (at least in the mean time) a quasi-quoter. I don‘t really like quasi-quoters as they have a number of problems (such as you can’t nest them, and to parse Haskell you need a third-party parser, and then you have problems with fixity resolution, …) but they might still be better than nothing in certain situations.
And apparently someone already made a package for this.
It's a Google group:
https://groups.google.com/forum/m/?fromgroups#!forum/streaming-haskell
... but I think there is some way to add it to GMane. I know Gergely did this for `haskell-pipes`.