[Ur] Optional URL arguments

Artyom Shalkhakov artyom.shalkhakov at gmail.com
Thu Mar 10 09:56:02 EST 2016


2016-03-10 18:29 GMT+06:00 Adam Chlipala <adamc at csail.mit.edu>:
> Your own message partly anticipates my answer!  You can use [queryString] to
> take in inputs in the usual way and process them however you like, since
> [queryString] has a [show] instance.
>
> However, even easier might be to change your function to take a plain old
> [string] as argument and parse it as you please.
>

Doh, why didn't I think of that??? Thanks much, Adam. Parsing will do.

> On 03/09/2016 10:26 PM, Artyom Shalkhakov wrote:
>>
>> Hello all,
>>
>> How to handle optional arguments? For instance, I'm writing a
>> pagination script and page number is an optional argument. If I use
>> the following function for pagination:
>>
>>> fun mypaginator (page_nr: option int): transaction page = ...
>>
>> Which maps to the URL of the form:
>>
>>> /Mymodule/mypaginator/Some/1
>>
>> or of the form:
>>
>>> /Mymodule/mypaginator/None
>>
>> Which users will not like, I guess.
>>
>> Coincidentally, why are there no functions to work with the type
>> [queryString]?
>>
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur



-- 
Cheers,
Artyom Shalkhakov



More information about the Ur mailing list