On Fri, Mar 19, 2010 at 4:22 PM, Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
As an example of both a unified URL creation framework and persistence framework, I&#39;ve put together a little example of how we could create an &quot;authentication plugin.&quot; For the purposes of our discussion here, we could ignore the persistence piece for now, though I would like to eventually discuss how we could make that better.</blockquote>
<div><br></div><div>Yeah, I gotta finish the urlt stuff first before I think about something else ;)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>I wrote a small blog post[1] describing the system. The code relevant for our discussion is broken into two files: WebPlug.hs[2] defines the interface and auth-example.hs[3] is the actual example.</div><div>
<br></div><div>In this version of WebPlug.hs, I&#39;ve included WebPlug as a datatype instead of a typeclass. I don&#39;t actually *use* that datatype here, but I think it would be very useful for higher-level utilities like the quasi-quoter to be able to access the three related functions together.</div>
</blockquote><div><br></div><div>Right. I already have a similar datatype in URLT.HandleT. My type also includes a &#39;defaultPage&#39; type which can be used to specify what value &quot;/&quot; should be mapped to. Though, in mine, the dispatch / handleLink function is based on URLT, but that can probably be generalized. As a bonus you also get a Functor instance, and a runSite function that uses the type..</div>
<div><br></div><div>You should really check out URLT sometime :p</div><div><br></div><div>I am not going to have time to look at this again until Saturday or Sunday. There are a few minor details that have been swept under the rug that need to be addressed. For example, when exactly does should url encoding / decoding take place. It&#39;s not good if that happens twice or not at all.</div>
<div><br></div><div>- jeremy</div></div>