[web-devel] Type-safe URL handling
jeremy at n-heptane.com
Tue Mar 16 17:00:25 EDT 2010
I believe this is essentially how URLT works, except the 'toAbsPath'
function is stored in the reader monad instead of being passed around
And advantage of using the reader monad is that it also ensures that you are
dispatching the right type of URL in each part. More on this in a different
On Tue, Mar 16, 2010 at 3:49 PM, Michael Snoyman <michael at snoyman.com>wrote:
> Here's a bit of an orthogonal gist to what Chris has posted. It's very
> tedious to program in this style, but it could form the basis for other
> libraries to build on top of it.
> WebPlug is a typeclass that consists of three methods: one to convert to a
> relative path, one to convert from a relative path, and a dispatch method.
> The trick is that dispatch is given a function that can convert a WebPlug
> into an *absolute* path.
> Given something like this, I could write a blog WebPlug that creates all
> internal links via the absolute path function. They would all be guaranteed
> to be valid by definition, and then the blog could be plugged into another
> application at any point.
> Some standards for loading settings and the like *might* be nice, but
> aren't really necesary. Also, I believe that this approach is compatible
> with either the regular package approach Chris uses above, or a
> quasi-quoting approach like in Yesod. (Obviously the Yesod code itself would
> have to change to accomodate this.)
> web-devel mailing list
> web-devel at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the web-devel