more parsing paper
Martin Norbäck
d95mback@dtek.chalmers.se
24 Jan 2002 09:53:05 +0100
ons 2002-01-23 klockan 22.18 skrev David Feuer:
> The paper I am reading uses the following in an instance declaration for
> parsers:
>
> p >>= f = Parser (\cs -> concat [parse (f a) cs' |
> (a,cs') <- parse p cs])
>
> Isn't this the same as
>
> p >>= f = Parser (\cs ->
> [(a',cs'') | (a,cs') <- parse p cs,
> (a',cs'') <- parse (f a) cs'])
> ?
>
> If so, any guesses why they chose the more obscure form?
Why do you say that the first form is less obscure? It uses less
bindings, and the non-obscure standard function concat.
Your version could be simplified, though, by replacing the expression
(a',cs'') with a single name.
Regards,
Martin
--
[ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN:
4439498 ]
Opinions expressed above are mine, and not those of my future
employees.
SIGBORE: Signature boring error, core dumped