Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-27 Thread Felipe Lessa
On Sun, Dec 27, 2009 at 09:34:54AM -0500, Edward Kmett wrote: > On Sun, Dec 27, 2009 at 8:59 AM, Felipe Lessa wrote: > > Is my example contrived? Am I missing something? :) > > Assuming a sufficiently smart preprocessor you can do anything you'd like, > but the result isn't an arrow. ;) Hehe, I s

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-27 Thread Edward Kmett
On Sun, Dec 27, 2009 at 8:59 AM, Felipe Lessa wrote: > > Hmmm... but, assuming a preprocessor, you probably would be able > to transform this code: > [snip] > The only part missing here is being able to run only a small part > of the arrow's computation and then return another Action. > >

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-27 Thread Felipe Lessa
On Sun, Dec 27, 2009 at 08:20:53AM -0500, Edward Kmett wrote: > On Fri, Dec 25, 2009 at 8:31 PM, Felipe Lessa wrote: > > However you're right in a sense, you can't use this scheme to > > serialize any functions taking functions, like > > > >something :: (a -> Parser a) -> a -> Parser a > > > >

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-27 Thread Edward Kmett
On Fri, Dec 25, 2009 at 8:31 PM, Felipe Lessa wrote: > > However you're right in a sense, you can't use this scheme to > serialize any functions taking functions, like > >something :: (a -> Parser a) -> a -> Parser a > > because > >data MyParser = FunSomething (a -> MyParser) a > > wouldn'

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-27 Thread Edward Kmett
On Fri, Dec 25, 2009 at 11:56 AM, Serguey Zefirov wrote: > A pair of problems: > 1) How to write a parser that could be restarted? Like, it will be > represented by a function that returns something along the lines > > data ParseStepResult input result = >Success (Maybe (input -> ParseStepResu

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Felipe Lessa
On Fri, Dec 25, 2009 at 05:12:22PM -0500, Antoine Latter wrote: > In that case, You'll be able to serialize that as long as you can > serialize (m a). > > I meant higher-order as in function-types. So you wouldn't be able to > serialize: > > string :: String -> Parser String > > Unless you had som

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Antoine Latter
On Fri, Dec 25, 2009 at 5:06 PM, Serguey Zefirov wrote: >>> AFAIK, one of HAppS modules does a similar transformation via >>> Template Haskell.  The functions specify transactions, and each >>> transaction is converted to a serializable data type.  Then it's >>> possible to create a transaction lo

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Serguey Zefirov
>> AFAIK, one of HAppS modules does a similar transformation via >> Template Haskell.  The functions specify transactions, and each >> transaction is converted to a serializable data type.  Then it's >> possible to create a transaction log by serializing them before >> their execution. > > The happ

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Serguey Zefirov
2009/12/25 Felipe Lessa : >> I am looking more for the way to serialize intermediate parser >> computations. The first problem is, actually, easy one. ;) > > Probably you'll have to create a data constructor for each step > of your parser. > > AFAIK, one of HAppS modules does a similar transformati

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Antoine Latter
On Fri, Dec 25, 2009 at 4:55 PM, Felipe Lessa wrote: > On Fri, Dec 25, 2009 at 11:25:41PM +0200, Serguey Zefirov wrote: >> I am looking more for the way to serialize intermediate parser >> computations. The first problem is, actually, easy one. ;) > > Probably you'll have to create a data construc

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Felipe Lessa
On Fri, Dec 25, 2009 at 11:25:41PM +0200, Serguey Zefirov wrote: > I am looking more for the way to serialize intermediate parser > computations. The first problem is, actually, easy one. ;) Probably you'll have to create a data constructor for each step of your parser. AFAIK, one of HAppS module

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Serguey Zefirov
2009/12/25 Valery V. Vorotyntsev : >> 1) How to write a parser that could be restarted? Like, it will be >> represented by a function that returns something along the lines >> >> data ParseStepResult input result = >>    Success (Maybe (input -> ParseStepResult input result)) (Maybe result) >>  | F

Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Valery V. Vorotyntsev
Serguey Zefirov wrote: > > 1) How to write a parser that could be restarted? Like, it will be > represented by a function that returns something along the lines > > data ParseStepResult input result = >Success (Maybe (input -> ParseStepResult input result)) (Maybe result) > | Failure > > (ie,

[Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Serguey Zefirov
A pair of problems: 1) How to write a parser that could be restarted? Like, it will be represented by a function that returns something along the lines data ParseStepResult input result = Success (Maybe (input -> ParseStepResult input result)) (Maybe result) | Failure (ie, parsers using str