Combinators for ReadP

Simon Marlow simonmar at microsoft.com
Tue Jul 27 10:22:54 EDT 2004


On 27 July 2004 15:16, Martin Sjögren wrote:

> On Tue, 27 Jul 2004 14:31:21 +0100, Simon Peyton-Jones
> <simonpj at microsoft.com> wrote:
>> 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. :)

Incedentally, universal quantification in constructor fields is one of the easier extensions to implement.  Much easier than multi-parameter type classes, for example.  You don't have to go the whole hog and implement rank-N polymorphism ala GHC in order to get most of the benefit.

Cheers,
	Simon


More information about the Libraries mailing list