<div dir="ltr">I should have looked at the mail archive, this question has already been asked.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 8, 2017 at 2:24 PM, Isaac Torbett <span dir="ltr"><<a href="mailto:izacht13@gmail.com" target="_blank">izacht13@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Huh, I still don't understand when to use return, and when not too, 'll have to find a tutorial for that then. Ill look at section 10, thanks.<br><br></div>I don't really understand what you mean by arguments, arguments in the transaction descriptor? If so what would that look like?<br><br></div>Again thanks for the help.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 8, 2017 at 2:19 PM, Adam Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 03/08/2017 01:51 PM, Isaac Torbett wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to get the urweb server to return json, but what is the type/kind I should put in the transaction monad?<br>
<br>
<br>
val main : <here> -> transaction page<br>
<br>
<br>
What would I put in <here>?<br>
<br>
Furthermore- I don't even know if my json-like structure is allowed, the compiler isn't complaining about it, so maybe it's fine.<br>
</blockquote>
<br></span>
I think Section 10 of the manual explains everything about how to write handlers that provide non-HTML-based APIs. In short, you probably want to use argument type [postBody] or [queryString], depending on how the JSON comes in. You can also use [returnBlob] to return JSON instead of HTML.<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
fun main () = return queryX1 (SELECT topic.Title, topic.Body FROM topic)<br>
</blockquote>
<br></span>
It looks like you're hung up on the basics of programming with monads, for which I'd recommend a Haskell monad tutorial. But the case-specific fix is to remove the [return].<br>
<br>
______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com" target="_blank">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" rel="noreferrer" target="_blank">http://www.impredicative.com/c<wbr>gi-bin/mailman/listinfo/ur</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>