[Haskell-cafe] (New to Conduits) mixing lazy lists and Conduits?

Li-yao Xia lysxia at gmail.com
Thu Jun 21 10:30:21 UTC 2018



On 06/21/2018 05:13 AM, Jon Fairbairn wrote:
> 
> Suppose I’m writing some code using Conduits, but need to use
> some old function f::[a]->[b] (defined in a library somewhere)
> that transforms a lazy list.
> 
> Is there a way of turning f into a Conduit without ending up
> with all of the list being in memory?

Constructing a list in such a streaming fashion only seems possible with 
unsafePerformIO trickery: define the input list lazily by reading a 
mutable reference, which gets populated whenever the conduit 'await's a 
new value.

Li-yao


More information about the Haskell-Cafe mailing list