[web-devel] ANN: url-generic-0.1: Parse/format generic key/value URLs from record data types.
Christopher Done
chrisdone at googlemail.com
Mon Jun 20 09:18:23 CEST 2011
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!
More information about the web-devel
mailing list