Something like `chunkEval` or `parallelize` wouldn't work 
 `Stream (Of a) m r`  with things  are written at the moment, 
since it is strict in the a's. 

One would have to intervene, e.g., at strategic `maps`, doing
something like what I was imagining earlier, which I guess doesnt
correspond to your problem. 

    mapSpeculate :: MonadIO m => Int -> (a -> b) -> Stream (Of a) m r -> 
Stream (Of b) m r 
    mapSpeculate n f p = S.concat 
                                       $ S.mapM (liftIO . mapConcurrently 
(evaluate . f)) 
                                       $ S.mapsM S.toList
                                       $ S.chunksOf n p

works fine for `fib` - which isn't saying much. Similarly with 

    parMapSpeculate :: (MonadIO m, NFData b) => Int -> (a -> b) -> Stream 
(Of a) m r -> Stream (Of b) m r 
    parMapSpeculate n f p = S.concat 
                                         $ S.map (runPar . parMap f) 
                                         $ S.mapsM S.toList
                                         $ S.chunksOf n p

which seems to me much faster. I'm not sure how to get a raw `par` 
operation going.

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