[Ur] Optional URL arguments

Adam Chlipala adamc at csail.mit.edu
Thu Mar 10 07:29:25 EST 2016


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.

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]?
>




More information about the Ur mailing list