[web-devel] Type-safe URL handling

Chris Eidhof chris at eidhof.nl
Mon Mar 29 12:28:13 EDT 2010


-chris

On 29 mrt 2010, at 18:18, Jeremy Shaw wrote:

> On Mon, Mar 29, 2010 at 8:47 AM, Michael Snoyman <michael at snoyman.com> wrote:
> Jeremy,
>  
> We'd been discussing the PathInfo class previously; I understand now what you're trying to achieve with it, but I think for a lot of use cases using a parser like that will be unnecesary. For those cases, I'd hate to introduce a parsec dependency, especially given the 2/3 split we're dealing with right now.
> 
> Well, parsec is in the haskell platform, so it's really a question of can be it implemented so that it works with both 2 and 3. 

I'm on the latest 6.12 platform, and I only have parsec-2.1 installed. Which packages use parsec-3?

> 
> So far you have been pretty unexcited about the parsing having a type similar to:
> 
>  [String] -> (Either String a, [String])
> 
> because it is often 'unnecessary'. But the problem with, [String] -> (Either String a), is that, as far as I can tell, it won't work in the cases where it *is* necessary. And you can't simply switch to, [String] -> (Either String a, [String]), when that happens.. But perhaps I am missing something here..

I think you're right, Jeremy. If you want an instance for :*:, (i.e. for a constructor with several fields), you definitely need a parser. Be it parsec or a hand-rolled Consumer-like parser, you do need one.

-chris


More information about the web-devel mailing list