<br><br><div class="gmail_quote">On Mon, Apr 12, 2010 at 1:17 AM, Peter Robinson <span dir="ltr">&lt;<a href="mailto:thaldyron@gmail.com">thaldyron@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 11 April 2010 07:00, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt; wrote:<br>
&gt;&gt; - Wouldn&#39;t it be simpler to automatically derive an instance of Show for<br>
&gt;&gt; the MyRoute type? (Since MyRoute is created on the fly anyway, I don&#39;t<br>
&gt;&gt; see why anyone would want to derive a different Show instance.)<br>
&gt;&gt;<br>
&gt; Multiple problems:<br>
&gt; * The rest of web-routes doesn&#39;t use Show that way.<br>
&gt; * Usually, we&#39;ll need another parameter to create this function, such as the<br>
&gt; application root.<br>
&gt; * Show is usually the inverse of Read. I suppose we could make the Read<br>
&gt; instance the other side, but that we&#39;re just not following what is normally<br>
&gt; expected of these instances, which is to return Haskell-formatted data.<br>
<br>
</div>Right. I&#39;ve noticed that your newest approach uses an &quot;explode&quot; function<br>
which makes the type signature of handler functions shorter. :)<br>
<div class="im"><br></div></blockquote><div>Wow, I can&#39;t believe anyone was able to follow that code ;). My hat&#39;s off to you.</div><div><br></div><div>Someone (maybe you) mentioned earlier that web-routes-quasi is geared more towards framework writers; I think this is probably very true. Nonetheless, before release I&#39;ll put in proper documentation about the type signatures of all the parameters, since the whole thing can be very tricky. I myself had trouble figuring it out for integration into Yesod, and I wrote all the packages involved!</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
&gt;&gt; - About the possibility of querying the supported methods: The use case<br>
&gt;&gt; scenario I have in mind is having a default handler for handling OPTIONS<br>
&gt;&gt; that returns the available methods. Currently this won&#39;t work since that<br>
&gt;&gt; part<br>
&gt;&gt; of the resource information is unavailable inside the handler. Do you have<br>
&gt;&gt; any<br>
&gt;&gt; thoughts on how to change the design to make this possible?<br>
&gt;<br>
&gt; Well, the simplest thing I can do is make the [Resource] result from the<br>
&gt; quasi-quoting available, which would give you enough information to write<br>
&gt; something to intercept OPTIONS requests before handing them to the rest of<br>
&gt; the application. Does that sound good enough?<br>
<br>
</div>Yes, sounds good. (Alternatively, I could separate parseRoutes from<br>
createRoutes<br>
and make the resources a top level declaration, which wouldn&#39;t require any<br>
changes on your part...)<br>
<font color="#888888"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#888888"><br></font></font></font></blockquote><div>Actually, that sounds like a much better idea. I&#39;m trying to ensure that web-routes-quasi generated code compiles without warnings on -Wall, and exporting information that won&#39;t be used normally would generate an unused warning.</div>
<div><br></div><div>Michael</div></div>