Mercurial > urweb
annotate tests/vlad3.ur @ 2122:8cf40452c900
Some new infix operators, contributed by Gabriel Riba
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 05 Mar 2015 14:50:31 -0500 |
parents | 7e3226c97678 |
children |
rev | line source |
---|---|
adamc@1052 | 1 cookie user : {EMail : string} |
adamc@1052 | 2 |
adamc@1052 | 3 fun main () = |
adamc@1052 | 4 ro <- getCookie user; |
adamc@1052 | 5 case ro of |
adamc@1052 | 6 Some u => welcome u |
adamc@1052 | 7 | _ => login () |
adamc@1052 | 8 |
adamc@1052 | 9 and welcome u = return <xml><body> |
adamc@1052 | 10 Welcome {[u.EMail]}. <a link={logout ()}>Logout</a> |
adamc@1052 | 11 </body></xml> |
adamc@1052 | 12 |
adamc@1052 | 13 and logout () = |
adamc@1052 | 14 clearCookie user; |
adamc@1052 | 15 main () |
adamc@1052 | 16 |
adamc@1052 | 17 and login () = return <xml><body> |
adamc@1052 | 18 <form>E-mail:<textbox{#EMail}/><submit action={signin}/></form> |
adamc@1052 | 19 </body></xml> |
adamc@1052 | 20 |
adamc@1052 | 21 and signin r = |
adamc@1052 | 22 setCookie user {Value = {EMail = r.EMail}, |
adamc@1052 | 23 Expires = None, (* Some (readError "2012-11-6 |
adamc@1052 | 24 00:00:00"), *) |
adamc@1052 | 25 Secure = False |
adamc@1052 | 26 }; |
adamc@1052 | 27 main () |