Re: [Haskell-cafe] Parsers are monadic?

2007-07-05 Thread Claus Reinke
(b) i like my combinator grammars to be reversible, so that a single grammar specification can be used for both parsing and unparsing/pretty-printing. that means i have to define the details myself anyway. the latest such experiment is not necessarily the simplest variant, for

Re: [Haskell-cafe] Parsers are monadic?

2007-07-04 Thread Malcolm Wallace
Claus Reinke [EMAIL PROTECTED] wrote: (b) i like my combinator grammars to be reversible, so that a single grammar specification can be used for both parsing and unparsing/pretty-printing. that means i have to define the details myself anyway. Oh cool - this is something I have

Re: [Haskell-cafe] Parsers are monadic?

2007-07-04 Thread Claus Reinke
(b) i like my combinator grammars to be reversible, so that a single grammar specification can be used for both parsing and unparsing/pretty-printing. that means i have to define the details myself anyway. Oh cool - this is something I have wanted for a long time. Anything

Re: [Haskell-cafe] Parsers are monadic?

2007-07-02 Thread Claus Reinke
contrary to monadic parsers, those continuation-based parsers had *two* continuations, one for success, one for failure. and that seemed to be a very natural match for the problem. Two-continuations is a monad too, right? yes, but my problem is not about giving them a monadic interface, but

Re: [Haskell-cafe] Parsers are monadic?

2007-07-01 Thread Claus Reinke
When you pretend you've never heard of monads or arrows, and write down the types what do you get? this question made me wonder whether i could still recall how i used to write parsers before i heard of monads or arrows. it is difficult not to fall back into the pattern of state transformer

Re: [Haskell-cafe] Parsers are monadic?

2007-07-01 Thread Paul Hudak
Hi Claus. I am sympathetic with your comments regarding monads and continuations. It's interesting to note that the original I/O system in Haskell was based on streams and continuations. The continuation version had two continuations in fact -- one for success and one for failure. For

Re: [Haskell-cafe] Parsers are monadic?

2007-07-01 Thread Jon Cast
On Saturday 30 June 2007, Claus Reinke wrote: The standard, naïve approach to monadic parsing is very nice, but inefficient. So *please read* some material based on HuttonMeijer approach, but don't stay there, read something more modern, since we thereby seem to have left the phase of simple

Re: [Haskell-cafe] Parsers are monadic?

2007-07-01 Thread Hugh Perkins
Big Chris wrote: http://www.cs.nott.ac.uk/~gmh/bib.html#monparsing Hey, just to say, the first few pages of this explain monads really well. Good reference :-) It's the first introduction to monads I've seen that describes monads directly, without using analogies, and manages to be both

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Big Chris
Hi Gregory, First post. I'm a newbie, been using Haskell for about a week and love it. Anyway, this is something I don't understand. Parsers are monadic. I can see this if the parser is reading from an input stream but if there's just a block of text can't you just have the parser call

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread jerzy . karczmarczuk
Big Chris writes to Gregory, who posts: ... something I don't understand. Parsers are monadic. I can see this if the parser is reading from an input stream but if there's just a block of text can't you just have the parser call itself recursively feeding the unparsed text down the recursion

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Claus Reinke
The standard, naïve approach to monadic parsing is very nice, but inefficient. So *please read* some material based on HuttonMeijer approach, but don't stay there, read something more modern, since we thereby seem to have left the phase of simple answers to simple questions;-) i'd like to raise

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Philippa Cowderoy
On Sat, 30 Jun 2007, Claus Reinke wrote: for all that i like monadic programming in general, i often feel that it is biased towards handling only the success path well, by offering built-in support for a single continuation only. Certainly one path gets privileged over the others, I don't

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Dave Bayer
On Jun 30, 2007, at 6:31 AM, Claus Reinke wrote: has anyone else had similar experiences with expressive limitations of monadic programming? things that one might be able to work around, but that don't feel as natural or simple as they should be? things that one hasn't been able to express at

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Claus Reinke
Have you used Parsec? i read about it when it came out, but i've always defined my own combinators. in case you wonder, there are two reasons for this: (a) the approximation of parsers as monads is close enough that a simple type Parser m a = StateT String m a gives us the basic

[Haskell-cafe] Parsers are monadic?

2007-06-29 Thread Gregory Propf
First post. I'm a newbie, been using Haskell for about a week and love it. Anyway, this is something I don't understand. Parsers are monadic. I can see this if the parser is reading from an input stream but if there's just a block of text can't you just have the parser call itself