[web-devel] Type-safe URL handling

Jeremy Shaw jeremy at n-heptane.com
Mon Mar 29 12:35:34 EDT 2010


On Mon, Mar 29, 2010 at 11:28 AM, Chris Eidhof <chris at eidhof.nl> wrote:

>
> -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?
>
> in web-routes, the PathInfo module now contains a function p2u ::  Parser a
-> URLParser a so that you can lift a Char parser to be a URL parser:

testp :: URLParser (Char, String, String)
testp =
  do segment "foo"
     st <- p2u (char 'h' >> char 'o')
     sg <- anySegment
     sg' <- anySegment
     return (st,sg, sg')

but I have not figured out how to implement p2u so that it works under
parsec 2 & 3. Maybe I'll just leave it out for now, but I am doing some
exploration first.

- jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100329/fd0d4b0b/attachment.html


More information about the web-devel mailing list