Re: [Haskell-cafe] Either Monad and Laziness

2012-09-18 Thread Malcolm Wallace
On 12 Sep 2012, at 16:04, Eric Velten de Melo wrote: The behaviour I want to achieve is like this: I want the program when compiled to read from a file, parsing the PGM and at the same time apply transformations to the entries as they are read and write them back to another PGM file. Such

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-17 Thread John Lato
Subject: Re: [Haskell-cafe] Either Monad and Laziness On 9/14/12 5:16 PM, Eric Velten de Melo wrote: But now I'm kinda lost. Is there an easy way to explain the difference between: -iteratee -conduit -enumerator I tend to group them into three families. 'iteratee' and 'enumerator

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-16 Thread wren ng thornton
On 9/14/12 5:16 PM, Eric Velten de Melo wrote: But now I'm kinda lost. Is there an easy way to explain the difference between: -iteratee -conduit -enumerator John Lato's iteratee library is the original one based on Oleg Kiselyov's work. I've used it a fair deal and am quite fond of it.

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-14 Thread Eric Velten de Melo
On 13 September 2012 20:29, wren ng thornton w...@freegeek.org wrote: On 9/12/12 5:37 PM, Francesco Mazzoli wrote: At Wed, 12 Sep 2012 12:04:31 -0300, Eric Velten de Melo wrote: It would be really awesome, though, if it were possible to use a parser written in Parsec with this, in the

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-13 Thread wren ng thornton
On 9/12/12 5:37 PM, Francesco Mazzoli wrote: At Wed, 12 Sep 2012 12:04:31 -0300, Eric Velten de Melo wrote: It would be really awesome, though, if it were possible to use a parser written in Parsec with this, in the spirit of avoiding code rewriting and enhancing expressivity and abstraction.

[Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread oleg
I am currently trying to rewrite the Graphics.Pgm library from hackage to parse the PGM to a lazy array. Laziness and IO really do not mix. The problem is that even using a lazy array structure, because the parser returns an Either structure it is only possible to know if the parser was

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread Eric Velten de Melo
Thanks for all the tips! The iteratees seem worth checking out. I'll see what I can do and will report back if I come up with something. Eric On 12 September 2012 03:03, o...@okmij.org wrote: I am currently trying to rewrite the Graphics.Pgm library from hackage to parse the PGM to a lazy

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread Eric Velten de Melo
On 12 September 2012 11:46, Eric Velten de Melo ericvm...@gmail.com wrote: Thanks for all the tips! The iteratees seem worth checking out. I'll see what I can do and will report back if I come up with something. Eric On 12 September 2012 03:03, o...@okmij.org wrote: I am currently trying

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread Francesco Mazzoli
At Wed, 12 Sep 2012 12:04:31 -0300, Eric Velten de Melo wrote: It would be really awesome, though, if it were possible to use a parser written in Parsec with this, in the spirit of avoiding code rewriting and enhancing expressivity and abstraction. There is

[Haskell-cafe] Either Monad and Laziness

2012-09-11 Thread Eric Velten de Melo
Hello, I am currently trying to rewrite the Graphics.Pgm library from hackage to parse the PGM to a lazy array. The current implementation parses it straight to UArray, which is strict. The behaviour I want to achieve is like this: I want the program when compiled to read from a file, parsing

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-11 Thread Evan Laforge
On Tue, Sep 11, 2012 at 9:36 AM, Eric Velten de Melo ericvm...@gmail.com wrote: Any thoughts? Hopefully I'm not saying anything really stupid. You can intersperse decoding errors in the output, e.g. output is [Either Error DecodedChunk]. Then all the processors have to deal with it, but if you

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-11 Thread timothyhobbs
Use a tuple: (Result,Maybe Error) rather than an Either.  Do everything lazily, and in the case of an error, undo the result. -- Původní zpráva -- Od: Eric Velten de Melo ericvm...@gmail.com Datum: 11. 9. 2012 Předmět: [Haskell-cafe] Either Monad and Laziness Hello, I am