[web-devel] ANN: url-generic-0.1: Parse/format generic key/value URLs from record data types.

Jeremy Shaw jeremy at n-heptane.com
Mon Jun 20 20:05:30 CEST 2011


How is this actually different from web-routes (which already supports
automatic url deriving via Template Haskell, generics, or

You suggest that web-routes requires a single URL type for all the
routes and that your code allows for multiple types. But I do not see
how that is actually done.

If you have two url types, Home and Event, and a URL comes in.. how do
you know if you need to call:

parseURLPath url :: Maybe Event


parseURLPath url :: Maybe Home

- jeremy

On Mon, Jun 20, 2011 at 2:18 AM, Christopher Done
<chrisdone at googlemail.com> wrote:
> Hello, chaps.
> I thought that it would be an interesting idea to generate URLs from
> plain old Haskell record data types using Data.Data/Typeable.
> Repo: https://github.com/chrisdone/url-generic
> Docs: http://hackage.haskell.org/packages/archive/url-generic/0.1/doc/html/Web-URL-Generic.html
> Seems like a success. Whether it's a good idea I'm still considering.
> Good points:
> * Works with standard data types.
> * Derives automatically and therefore predictably.
> * Disallows conflicts between URL representations (e.g. can't
> accidentally make up /1234 for "event 1234" and /1234 for "blog post
> 1234")
> * The data type, being simple, can therefore be nicely pattern-matched
> upon, something I use extensively is record wildcarding.
> * Ordering of parameters doesn't matter.
> * Fields of type Maybe a can be optionally provided or not.
> * Enum data types "just work", nice for providing choice in URLs.
> Bad points:
> * Sometimes you want custom URLs like "/1234" for convenience.
> * Not sure how this would interact with web-routes and those type of
> packages because they use only *one* type for *all* URLs.
> Let me know your thoughts.
> Ciao!
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel

More information about the web-devel mailing list