[web-devel] Type-safe URL handling

Jeremy Shaw jeremy at n-heptane.com
Tue Mar 23 15:59:17 EDT 2010


My solution, by the way was to change fromURL to have a type more like:

 fromURL :: [String] -> (Failing a, [String])

so that it returns the unconsumed portion of the path segments.

If you get the latest urlt from darcs:

darcs get http://src.seereason.com/urlt/

I have ported the regular stuff over already. Someone needs to add the
missing instance for :*:.

In that code I am using the Consumer monad, which is just a wrapped up
version of ([c] -> (a, [c])).

The URLT library as a whole does not build at the moment, but he parts
needed to fix URLT.Regular do.

- jeremy

On Tue, Mar 23, 2010 at 2:36 PM, Jeremy Shaw <jeremy at n-heptane.com> wrote:

> What happens if you have,
>
> data UserRoute = Find Int Int
>
> you need a instance:
>
> instance (GToURL f, GToURL g) => GToURL (f :*: g)
>
> I think?
>
> But the fromURL / gfromURL functions do not have a way to indicate how much
> of the input they consumed -- which I think will be a problem?
>
> I believe the current code works because it assumes that each call to
> gfromURL will consume all the remaining input. But when your constructor has
> two arguments, the first one better not consume all the rest of the input..
>
> - jeremy
>
> On Tue, Mar 16, 2010 at 3:52 AM, Chris Eidhof <chris at eidhof.nl> wrote:
>
>> Hey everyone,
>>
>> I just wrote down some of my ideas about type-safe URL handling on github,
>> it's at http://gist.github.com/333769
>>
>> I think it's similar to what Jeremy is doing with his urlt package [1].
>>
>> -chris
>>
>> [1]: http://src.seereason.com/~jeremy/SimpleSite1.html
>>
>> _______________________________________________
>> web-devel mailing list
>> web-devel at haskell.org
>> http://www.haskell.org/mailman/listinfo/web-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100323/bfaa825c/attachment.html


More information about the web-devel mailing list