[Ur] Invalid Link expression

Artyom Shalkhakov artyom.shalkhakov at gmail.com
Thu May 18 02:20:05 EDT 2017


2017-05-18 12:01 GMT+06:00 Aistis Raulinaitis <sheganinans at gmail.com>:
> So I am trying to pass around a list (string * link) to a function that will
> make the string a clickable link, however I run into this error.
>
>
> fun some () : transaction page = return <xml></xml>
> fun anot () : transaction page = return <xml></xml>
>
> fun link_list (l : list (string * (transaction page))) : xbody =
>     <xml>
>       {List.mapX (fn (s,p) => <xml><a link={p}>{[s]}</a></xml>) l}
>     </xml>
>
> fun main () : transaction page =
>     return <xml>
>       <body>
> {link_list (("sm", some ()) :: ("anot", anot ()) :: [])}
>       </body>
>     </xml>
>

The type [url] is first-class; how about replacing your usage of
(transaction page) with it? The following:

>> {link_list (("sm", some ()) :: ("anot", anot ()) :: [])}

becomes

>> {link_list (("sm", url (some ())) :: ("anot", url (anot ())) :: [])}

IIRC, "url" has type: [transaction page -> url], but you'll have to
search in basis for the exact type. The function [link_list] will have
to be changed accordingly.

>
> make -k
> urweb main
> /Users/ace/src/link_test/main.ur:7:44: (to 7:45) Invalid Link expression
> Expression UNBOUND_0
> make: *** [all] Error 1
>
> _______________________________________________
> 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