Re: [Haskell-cafe] Hierachical abstraction

2010-01-29 Thread Nils Anders Danielsson
On 2010-01-29 01:09, Edward Kmett wrote: Luke pretty much nailed the summary of what you can parse using Applicative means. I tend to consider them codata CFGs, because they can have infinite breadth and depth. However, a 'codata CFG' can handle a much larger class of languages than CFGs. To

Re: [Haskell-cafe] Hierachical abstraction

2010-01-29 Thread Andrew Coppin
Luke Palmer wrote: On Thu, Jan 28, 2010 at 12:42 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I wonder if you can make a parser combinator library which is *not* monadic? And, if you could, in what way would that limit the kinds of things you can parse? Absolutely! I believe

Re: [Haskell-cafe] Hierachical abstraction

2010-01-29 Thread Andrew Coppin
Edward Kmett wrote: Luke pretty much nailed the summary of what you can parse using Applicative means. I tend to consider them codata CFGs, because they can have infinite breadth and depth. However, a 'codata CFG' can handle a much larger class of languages than CFGs. Aren't CFGs banned in

Re: [Haskell-cafe] Hierachical abstraction

2010-01-29 Thread Luke Palmer
On Fri, Jan 29, 2010 at 11:45 AM, Andrew Coppin andrewcop...@btinternet.com wrote: But now suppose that I want not just circles, but *anything* that can possibly be reduced to line segments. If all you know about it is that it can be reduced to line segments, there is no loss of generality in

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Luke Palmer
On Thu, Jan 28, 2010 at 12:42 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I wonder if you can make a parser combinator library which is *not* monadic? And, if you could, in what way would that limit the kinds of things you can parse? Absolutely! I believe both Applicatives and Arrows

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Sebastian Fischer
On Jan 28, 2010, at 9:31 PM, Luke Palmer wrote: I don't remember the name, but there is a technique where you compose the features you want and then take its fixed point to get your AST. Did you think of Data types à la carte by Wouter Swierstra?

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Nils Anders Danielsson
On 2010-01-28 20:31, Luke Palmer wrote: I could be mistaken, but at least there are both Applicative and Arrow parser libraries. I don't know how to classify the language that they parse -- it is not strictly context-free. It corresponds roughly to context-free where certain types of infinite

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Edward Kmett
Luke pretty much nailed the summary of what you can parse using Applicative means. I tend to consider them codata CFGs, because they can have infinite breadth and depth. However, a 'codata CFG' can handle a much larger class of languages than CFGs. To that end, it is interesting to consider that

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Edward Kmett
On Thu, Jan 28, 2010 at 7:58 PM, Nils Anders Danielsson n...@cs.nott.ac.uk wrote: If the token set is finite you don't get any expressive advantage from a monadic parser combinator library (in a lazy setting): you can parse any decidable language using a simple library with an applicative