view tests/cookie.ur @ 1053:4eb1c4a1b057

Escaping UTF-8 in MonoOpt
author Adam Chlipala <adamc@hcoop.net>
date Thu, 03 Dec 2009 11:20:13 -0500
parents 1626dcba13ee
children
line wrap: on
line source
cookie c : string

fun other () =
    so <- getCookie c;
    case so of
        None => return <xml>No cookie</xml>
      | Some s => return <xml>Cookie: {[s]}</xml>

structure M = struct
    fun aux () =
        setCookie c "Hi";
        so <- getCookie c;
        case so of
            None => return <xml>No cookie</xml>
          | Some s => return <xml><body>Cookie: {[s]}<br/>
            <a link={other ()}>Other</a></body></xml>
end

fun main () : transaction page = return <xml><body>
  <a link={other ()}>Other</a><br/>
  <a link={M.aux ()}>Aux</a><br/>
</body></xml>