[Haskell-cafe] The Proliferation of List-Like Types

Thomas Schilling nominolo at googlemail.com
Fri Feb 22 03:31:06 EST 2008

On 22 feb 2008, at 08.18, Jules Bean wrote:

> Thomas Schilling wrote:
>> On 21 feb 2008, at 18.35, Johan Tibell wrote:
>>> I switched from lazy bytestrings to a left fold in my networking  
>>> code
>>> after reading what Oleg wrote about streams vs folds. No problems  
>>> with
>>> handles, etc. anymore.
>> Do you fold over chunks?  Can you continue to use Parsek or other  
>> utilities that need a stream-abstraction, and if so, how do you  
>> handle the end of a chunk.  This is the kind of callback interface  
>> where lazy evaluation really abstracts things nicely.
> You can't call a stream-abstraction utility using a left-fold- 
> enumerator without cheating (unsafeInterleave), because the stream- 
> abstraction is incompatible (and leaky! even though it is convenient).
> You can convert in the other direction fine.
> Chunk are no problem, and convertible: you can build an element  
> fold from a chunk fold, and a chunk fold from an element fold (as  
> long as there is an 'end-of-input' marker).

Hm, thinking about it, parsers just need to be able to return a  
continuation instead of fail at the end of the input.  This  
continuation can then be invoked with the next chunk as input.

More information about the Haskell-Cafe mailing list