view tests/cookieSec.ur @ 1639:6c00d8af6239

Add a new scoping check for unification variables, to fix a type inference bug
author Adam Chlipala <>
date Sun, 18 Dec 2011 11:29:13 -0500
parents f2a2be93331c
line wrap: on
line source
table t : {Id : int}

cookie c : int

fun setter r =
    setCookie c (readError r.Id);
    return <xml>Done</xml>

fun writer () =
    ido <- getCookie c;
    case ido of
        None => error <xml>No cookie</xml>
      | Some id => dml (INSERT INTO t (Id) VALUES ({[id]}));
                   return <xml>Done</xml>

fun main () = return <xml><body>
    <textbox{#Id}/> <submit value="Get cookie" action={setter}/>

    <submit value="Write to database" action={writer}/>