<div>The latest version of the code is now at:</div><div><br></div><div><a href="http://src.seereason.com/web-routes/">http://src.seereason.com/web-routes/</a></div><div><br></div><div>- jeremy</div><br><div class="gmail_quote">
On Fri, Mar 26, 2010 at 5:36 AM, Victor Nazarov <span dir="ltr">&lt;<a href="mailto:asviraspossible@gmail.com">asviraspossible@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Mar 25, 2010 at 11:31 PM, Jeremy Shaw &lt;<a href="mailto:jeremy@n-heptane.com">jeremy@n-heptane.com</a>&gt; wrote:<br>
&gt; Hello Victor,<br>
&gt; The current version of urlt already has template haskell code for<br>
&gt; automatically generating the url from the data type. There is an example of<br>
&gt; that in WaiExample.hs.<br>
&gt; I find that the TH is great when developing the application, because it<br>
&gt; &#39;just works&#39;. But when the app gets closer to release, I sometimes want to<br>
&gt; customize the way the urls look. (for seo, etc). The nice part is that I can<br>
&gt; just write some custom instances of PathInfo instead of deriving them, and<br>
&gt; all of the other code just works.<br>
&gt; Is there something more that you wanted the TH code to do?<br>
<br>
</div>It sounds just like what I want. Where is the latest code to check it out?<br>
<div><div></div><div class="h5"><br>
&gt;<br>
&gt; On Thu, Mar 25, 2010 at 12:11 PM, Victor Nazarov &lt;<a href="mailto:asviraspossible@gmail.com">asviraspossible@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Thu, Mar 25, 2010 at 6:48 AM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Mar 24, 2010 at 3:36 PM, Jeremy Shaw &lt;<a href="mailto:jeremy@n-heptane.com">jeremy@n-heptane.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Mon, Mar 22, 2010 at 9:41 PM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; If I&#39;m not mistaken, I think that addresses all the issues on the<br>
&gt;&gt; &gt;&gt;&gt; table;<br>
&gt;&gt; &gt;&gt;&gt; is there anything left to decide? I look forward to seeing a sample<br>
&gt;&gt; &gt;&gt;&gt; URLT :).<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; There were other issues that came up, but nothing exciting enough to<br>
&gt;&gt; &gt;&gt; talk<br>
&gt;&gt; &gt;&gt; about.<br>
&gt;&gt; &gt;&gt; I have pushed a patch which I think brings the code up to date in terms<br>
&gt;&gt; &gt;&gt; of<br>
&gt;&gt; &gt;&gt; functionality. See WaiExample for a detail of everything that is<br>
&gt;&gt; &gt;&gt; currently<br>
&gt;&gt; &gt;&gt; supported (aside from the happstack / hsp stuff).<br>
&gt;&gt; &gt;&gt; The next steps are to:<br>
&gt;&gt; &gt;&gt;  1. change the names of any functions or types that we do not currently<br>
&gt;&gt; &gt;&gt; like<br>
&gt;&gt; &gt;&gt;  2. add the haddock documentation<br>
&gt;&gt; &gt;&gt;  3. split the package into separate packages so that you don&#39;t have to<br>
&gt;&gt; &gt;&gt; pull in extra dependencies that you aren&#39;t going to use<br>
&gt;&gt; &gt;&gt;  4. turn the WaiExample into a literate tutorial / blog post<br>
&gt;&gt; &gt;&gt;  5. add a (simple) happstack example as well<br>
&gt;&gt; &gt;&gt; So take a look and let me know what you think. Especially in regards to<br>
&gt;&gt; &gt;&gt; #1.<br>
&gt;&gt; &gt;&gt; Then we can also look into how to extend the yesod mkResources stuff to<br>
&gt;&gt; &gt;&gt; work with this new code.<br>
&gt;&gt; &gt;&gt; from a parsing point of view, we almost don&#39;t have to do anything, we<br>
&gt;&gt; &gt;&gt; could just do:<br>
&gt;&gt; &gt;&gt;  [mkResource|  &quot;/foo/:int/:int&quot; = \i j -&gt; mySite (Foo i j) |]<br>
&gt;&gt; &gt;&gt; or whatever the syntax is. But that does not solve the issue of how to<br>
&gt;&gt; &gt;&gt; go<br>
&gt;&gt; &gt;&gt; from (Foo 1 2) back to /foo/1/2 and ensure that it is the inverse<br>
&gt;&gt; &gt;&gt; operation.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt; I don&#39;t have time right now to look at the code, but I will soon (I&#39;m in<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; middle of traveling *again*). Regarding the mkResource issue, I think<br>
&gt;&gt; &gt; it&#39;s<br>
&gt;&gt; &gt; slightly more complicated, and what I was thinking of was a combination<br>
&gt;&gt; &gt; of<br>
&gt;&gt; &gt; TemplateHaskell and QuasiQuotes to address it:<br>
&gt;&gt; &gt; * The quasi-quoted content will follow mostly the same syntax, though<br>
&gt;&gt; &gt; allowing you to specify the name of the constructor you wish to assign<br>
&gt;&gt; &gt; to<br>
&gt;&gt; &gt; each resource pattern.<br>
&gt;&gt; &gt; * Since we now will need to have multiple top-level definitions being<br>
&gt;&gt; &gt; generated, quasi-quoting alone won&#39;t solve the issue. So I will have a<br>
&gt;&gt; &gt; quasi-quote function to convert the YAML syntax to a StringObject, and<br>
&gt;&gt; &gt; then<br>
&gt;&gt; &gt; a TH function to convert the StringObject to:<br>
&gt;&gt; &gt;   1) A datatype for the URL.<br>
&gt;&gt; &gt;   2) A pair to to/from functions.<br>
&gt;&gt; &gt;   3) A dispatch function.<br>
&gt;&gt; &gt; This is the point at which having WebPlug/HandleT becomes useful.<br>
&gt;&gt; &gt; If that was too vague, just let me know and I&#39;ll clarify ;).<br>
&gt;&gt;<br>
&gt;&gt; Hello, everybody.<br>
&gt;&gt;<br>
&gt;&gt; I haven&#39;t been following the entire thread. But I think that typed<br>
&gt;&gt; URLs are great. When I started thinking about typed URLs, I thought<br>
&gt;&gt; about using only data type definition and dropping quosi-quotation<br>
&gt;&gt; entirely in favour of template haskell. I wanted to write some<br>
&gt;&gt; template haskell function to work on data-type declaration, it would<br>
&gt;&gt; use data-constructors names and arguments and build path components<br>
&gt;&gt; from their names. So we will need no new notation to describe<br>
&gt;&gt; application resources, we will never be conserned with URL generator<br>
&gt;&gt; and parser, we will work with our own, carefully defined data-type as<br>
&gt;&gt; it IS a URL.<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Victor Nazarov<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div>--<br>
<font color="#888888">Victor Nazarov<br>
</font></blockquote></div><br>