Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-09-07 Thread John Lato
At first I regarded this as simply a bug in the Iteratee.map definition, but like Ben, it's started to bother me a lot. I think this is precisely the sort of issue a proper denotational semantics would fix. Unfortunately the only general solution I see is to abandon chunking and work strictly

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-09-07 Thread John Millikin
On Mon, Sep 6, 2010 at 22:49, Ben midfi...@gmail.com wrote: Sorry to be late coming into this conversation. Something that has bothered me (which I have mentioned to John Lato privately) is that it is very easy to write non-compositional code due to the chunking.  For example, there is a

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-09-06 Thread Ben
Sorry to be late coming into this conversation. Something that has bothered me (which I have mentioned to John Lato privately) is that it is very easy to write non-compositional code due to the chunking. For example, there is a standard function map :: (a - b) - Enumeratee a b c whose

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-09-01 Thread Heinrich Apfelmus
Tilo Wiklund wrote: Daniel Fischer wrote: [...] Well, I just gave an example where one would want chunking for reasons other than performance. That iteratees don't provide the desired functionality is a different matter. [...] In the case of hashing, wouldn't it be more reasonable to consider

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-28 Thread Tilo Wiklund
On 26/08/2010, Daniel Fischer daniel.is.fisc...@web.de wrote: [...] Well, I just gave an example where one would want chunking for reasons other than performance. That iteratees don't provide the desired functionality is a different matter. [...] In the case of hashing, wouldn't it be more

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-27 Thread Heinrich Apfelmus
Daniel Fischer wrote: Heinrich Apfelmus wrote: Daniel Fischer wrote: For many hashing or de/encryption algorithms, chunking is more natural than single-character access. Even when the chunk lengths are unpredictable? After all, unlike with fread in C, you can't request the next chunk to

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-26 Thread Heinrich Apfelmus
Daniel Fischer wrote: John Lato wrote: Heinrich Apfelmus wrote: Do you have an example where you want chunking instead of single character access? I am unable to think of any examples where you want chunking for any reason other than efficiency. For many hashing or de/encryption

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-26 Thread Daniel Fischer
On Thursday 26 August 2010 09:33:30, Heinrich Apfelmus wrote: Daniel Fischer wrote: John Lato wrote: Heinrich Apfelmus wrote: Do you have an example where you want chunking instead of single character access? I am unable to think of any examples where you want chunking for any

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-25 Thread Heinrich Apfelmus
Stephen Tetley wrote: John Lato wrote: This is how I think of them. I particularly your description of them as a foldl with a pause button. Maybe it would be helpful to consider iteratees along with delimited continuations? Aren't they closer - in implementation and by supported operations

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-25 Thread Heinrich Apfelmus
Jason Dagit wrote: Heinrich Apfelmus wrote: I'm curious, can you give an example where you want to be explicit about chunking? I have a hard time imagining an example where chunking is beneficial compared to getting each character in sequence. Chunking seems to be common in C for reasons of

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-25 Thread Heinrich Apfelmus
Nicolas Pouillard wrote: Heinrich Apfelmus wrote: There are also enumerators and enumeratees. I think that purpose of enumerator = run an iteratee on multiple sources (i.e. first part of the input from a Handle , second part from a String ) I would say

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-25 Thread John Lato
From: Heinrich Apfelmus apfel...@quantentunnel.de Jason Dagit wrote: Heinrich Apfelmus wrote: I'm curious, can you give an example where you want to be explicit about chunking? I have a hard time imagining an example where chunking is beneficial compared to getting each character in

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-25 Thread Daniel Fischer
On Wednesday 25 August 2010 13:53:47, John Lato wrote: From: Heinrich Apfelmus apfel...@quantentunnel.de Do you have an example where you want chunking instead of single character access? I am unable to think of any examples where you want chunking for any reason other than efficiency.

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread Conal Elliott
Here's a way I've been tinkering with to think about iteratees clearly. For simplicity, I'll stick with pure, error-free iteratees for now, and take chunks to be strings. Define a function that runs the iteratee: runIter :: Iteratee a - [String] - (a, [String]) Note that chunking is explicit

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread Heinrich Apfelmus
Conal Elliott wrote: Is there a simpler model of Enumerator? My intuition is that it's simply a stream: [[Enumerator a]] = String Oddly, 'a' doesn't show up on the RHS. Maybe the representation ought to be type Enumerator = forall a. Iteratee a - Iteratee a so [[Enumerator]] = String

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread Heinrich Apfelmus
Jason Dagit wrote: From a purely practical viewpoint I feel that treating the chunking as an abstraction leak might be missing the point. If you said, you wanted the semantics to acknowledge the chunking but be invariant under the size or number of the chunks then I would be happier. I use

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread Jason Dagit
On Tue, Aug 24, 2010 at 12:49 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Jason Dagit wrote: From a purely practical viewpoint I feel that treating the chunking as an abstraction leak might be missing the point. If you said, you wanted the semantics to acknowledge the chunking

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread John Lato
I think the big problem with chunking is that many useful iteratees need to be able to inspect the length of the chunk. The most obvious is drop, but there are many others. Or if not inspect the length, have a new function on the stream dropReport :: Int - s - (s, Int) which reports how much was

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread Conal Elliott
Hi John, Please note that I'm suggesting eliminating chunks from the semantics only -- not from the implementation. For precise simple chunk-less semantics, it's only important that the iteratees map equivalent input streams to equivalent output streams, where equivalent means equal after

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread John Lato
Hi Conal, I'm aware of one case that violates semantic referential transparency, but it's a bug. Which pretty much proves your point as I understand it. John On Tue, Aug 24, 2010 at 2:01 PM, Conal Elliott co...@conal.net wrote: Hi John, Please note that I'm suggesting eliminating chunks

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Heinrich Apfelmus
Conal Elliott wrote: For anyone interested in iteratees (etc) and not yet on the iteratees mailing list. I'm asking about what iteratees *mean* (denote), independent of the various implementations. My original note (also at the end below): In my world view, iteratees are just a monad M with

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Luke Palmer
On Mon, Aug 23, 2010 at 1:06 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Conal Elliott wrote: For anyone interested in iteratees (etc) and not yet on the iteratees mailing list. I'm asking about what iteratees *mean* (denote), independent of the various implementations.  My

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Heinrich Apfelmus
Luke Palmer wrote: Heinrich Apfelmus wrote: Conal Elliott wrote: For anyone interested in iteratees (etc) and not yet on the iteratees mailing list. I'm asking about what iteratees *mean* (denote), independent of the various implementations. In my world view, iteratees are just a monad M

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Nicolas Pouillard
On Mon, 23 Aug 2010 14:38:29 +0200, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Luke Palmer wrote: Heinrich Apfelmus wrote: Conal Elliott wrote: For anyone interested in iteratees (etc) and not yet on the iteratees mailing list. I'm asking about what iteratees *mean* (denote),

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Conal Elliott
I have omitted the chunking [Char] because I don't like it; invariance with respect to the chunk sizes is something that should be left to the iteratee abstraction. I have this same reservation about iteratees. And related one for enumerators and enumeratees. Assuming my sense of their

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Conal Elliott
So perhaps this could be a reasonable semantics? Iteratee a = [Char] - Maybe (a, [Char]) I've been tinkering with this model as well. However, it doesn't really correspond to the iteratee interfaces I've seen, since those interfaces allow an iteratee to notice size and number of chunks. I

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Jason Dagit
I'm not a semanticist, so I apologize right now if I say something stupid or incorrect. On Mon, Aug 23, 2010 at 9:57 PM, Conal Elliott co...@conal.net wrote: So perhaps this could be a reasonable semantics? Iteratee a = [Char] - Maybe (a, [Char]) I've been tinkering with this model as

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Conrad Parker
On 24 August 2010 14:14, Jason Dagit da...@codersbase.com wrote: I'm not a semanticist, so I apologize right now if I say something stupid or incorrect. On Mon, Aug 23, 2010 at 9:57 PM, Conal Elliott co...@conal.net wrote: So perhaps this could be a reasonable semantics? Iteratee a =

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Jason Dagit
On Mon, Aug 23, 2010 at 10:37 PM, Conrad Parker con...@metadecks.orgwrote: On 24 August 2010 14:14, Jason Dagit da...@codersbase.com wrote: I'm not a semanticist, so I apologize right now if I say something stupid or incorrect. On Mon, Aug 23, 2010 at 9:57 PM, Conal Elliott

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread Conrad Parker
On 24 August 2010 14:47, Jason Dagit da...@codersbase.com wrote: On Mon, Aug 23, 2010 at 10:37 PM, Conrad Parker con...@metadecks.org wrote: On 24 August 2010 14:14, Jason Dagit da...@codersbase.com wrote: I'm not a semanticist, so I apologize right now if I say something stupid or