RE: Combinators for ReadP

You could do this, I believe, but it'd make ReadP less covenient for most users, because they'd have to add these redundant (and inexplicable) 'r' parameters. By "inexplicable" I mean that given a value
p::ReadP r a
we can say that p is a parser that parses some input, returning a value of type 'a'... but what's this 'r' thing?
Wrapping up a polymorphic fn in a newtype is very standard, even though it is not H98.
I'd be pretty reluctant to make this change
Simon
| -----Original Message-----
| From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf Of Martin
| Sjögren
| Sent: 26 July 2004 12:18
| To: libraries@haskell.org
| Subject: Re: Combinators for ReadP
|
| On Mon, 26 Jul 2004 11:00:31 +0100, Malcolm Wallace
|

On Tue, 27 Jul 2004 14:31:21 +0100, Simon Peyton-Jones
You could do this, I believe, but it'd make ReadP less covenient for most users, because they'd have to add these redundant (and inexplicable) 'r' parameters. By "inexplicable" I mean that given a value p::ReadP r a we can say that p is a parser that parses some input, returning a value of type 'a'... but what's this 'r' thing?
Wrapping up a polymorphic fn in a newtype is very standard, even though it is not H98.
I'd be pretty reluctant to make this change
Oh I agree. Having to pass around the extra parameter sucks. Unfortunately, nhc98 doesn't support forall. :) Would it be possible to do something like newtype Parser r a = R ((a -> P r) -> P r) #ifndef __NHC98__ type ReadP a = forall r. Parser r a #endif or something like that? Would that work? Does it even make sense? /Martin
participants (2)
-
Martin Sjögren
-
Simon Peyton-Jones