Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-26 Thread John Lato
Joining slightly late... From: John Millikin jmilli...@gmail.com John Lato's iteratee package is based on IterateeMCPS.hs[1]. I used IterateeM.hs for enumerator, because when I benchmarked them the non-CPS version was something like 10% faster on most operations. Based on tests I did

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-26 Thread John Millikin
On Tuesday, April 26, 2011 7:19:25 AM UTC-7, John Lato wrote: I'd be interested to see the results of a shootout between iteratee and enumerator. I would expect them to be basically equivalent most of the time, with maybe two or three operations with a small (but consistent) difference

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-26 Thread John Lato
On Tue, Apr 26, 2011 at 6:32 PM, John Millikin jmilli...@gmail.com wrote: On Tuesday, April 26, 2011 7:19:25 AM UTC-7, John Lato wrote: I'd be interested to see the results of a shootout between iteratee and enumerator. I would expect them to be basically equivalent most of the time, with

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-22 Thread Maciej Marcin Piechotka
On Tue, 2011-04-19 at 10:02 -0300, Felipe Almeida Lessa wrote: Now, that's what I get from reading the code. I don't remember if it is explicitly allowed or forbidden for an iteratee to generate leftovers out of nowhere. My guess is that it doesn't make much sense to allow it. For the

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-22 Thread Felipe Almeida Lessa
On Fri, Apr 22, 2011 at 5:54 AM, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: For the record: such code is therefore illegal abab :: Iteratee Char Identity () abab = continue parseA       where parseA (Chunks ('a':'b':xs)) = parseA (Chunks xs)             parseA (Chunks ('a':[])) =

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-22 Thread John A. De Goes
You wouldn't be so confused if you had actually looked at Lato's implementation and compared it to Oleg's most recent version. Regards, John A. De Goes Twitter: @jdegoes LinkedIn: http://linkedin.com/in/jdegoes On Apr 21, 2011, at 6:27 PM, Jason Dagit wrote: On Thu, Apr 21, 2011 at

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-21 Thread oleg
Daniel Schuessler wrote: The thing I don't understand yet is the last line: Why is it OK to discard the leftover input from the (f x) Iteratee and yield just the leftover input from the first one (m0)? First of all, the question is about an older version of Iteratee. For example, the

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-21 Thread John A. De Goes
This is a much cleaner definition of Iteratee and I'm happy to see it. When are you going to move from your FTP site to Github, by the way? :) Regards, John A. De Goes Twitter: @jdegoes LinkedIn: http://linkedin.com/in/jdegoes On Apr 21, 2011, at 12:32 AM, o...@okmij.org wrote: Daniel

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-21 Thread Jason Dagit
On Thu, Apr 21, 2011 at 8:36 AM, John A. De Goes j...@n-brain.net wrote: This is a much cleaner definition of Iteratee and I'm happy to see it. I'm confused by this comment. Isn't John Lato's implementation of Iteratee (on hackage) is based on the example implementation that Oleg pointed you

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-21 Thread John Millikin
John Lato's iteratee package is based on IterateeMCPS.hs[1]. I used IterateeM.hs for enumerator, because when I benchmarked them the non-CPS version was something like 10% faster on most operations. The new IterateeM.hs solves some problems with the old encoding, but I haven't switched

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-20 Thread John Millikin
It's forbidden for an iteratee to yield extra input that it hasn't consumed; however, this is unfortunately not enforced by the type system. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-20 Thread John A. De Goes
It's not OK and it's an artifact of the weak-typing and ill-defined semantics that pervade iteratee libraries. It's possible to do a lot of bad stuff, including binding with an iteratee yielding a remainder without consuming input. Regards, John A. De Goes Twitter: @jdegoes LinkedIn:

[Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-19 Thread Daniel Schüssler
Hello, for reference, said instance is: instance Monad m = Monad (Iteratee a m) where return x = yield x (Chunks []) m0 = f = ($ m0) $ fix $ \bind m - Iteratee $ runIteratee m = \r1 - case r1 of Continue k -

Re: [Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-19 Thread Felipe Almeida Lessa
2011/4/19 Daniel Schüssler anotheraddr...@gmx.de: Hello, for reference, said instance is: instance Monad m = Monad (Iteratee a m) where       return x = yield x (Chunks [])       m0 = f = ($ m0) $ fix $               \bind m - Iteratee $ runIteratee m = \r1 -                       case