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.
I don't really understand what you mean by arguments, arguments in the transaction descriptor? If so what would that look like? Again thanks for the help. On Wed, Mar 8, 2017 at 2:19 PM, Adam Chlipala <[email protected]> wrote: > On 03/08/2017 01:51 PM, Isaac Torbett wrote: > >> I'm trying to get the urweb server to return json, but what is the >> type/kind I should put in the transaction monad? >> >> >> val main : <here> -> transaction page >> >> >> What would I put in <here>? >> >> 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. >> > > 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. > > fun main () = return queryX1 (SELECT topic.Title, topic.Body FROM topic) >> > > 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]. > > _______________________________________________ > Ur mailing list > [email protected] > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur >
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
