diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-01-08 10:15:45 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-01-08 10:15:45 -0500 |
commit | c2e441e71003b5e49d1dc880f26b25792501342b (patch) | |
tree | 222afdcae4c1001350fc852d989430730a0efdbf /tests | |
parent | 90dfc7504b401b3b8b8964bb0725db20f31675e1 (diff) |
Injected a polymorphic, recursive type
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jsinj.ur | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/jsinj.ur b/tests/jsinj.ur index 518748d8..f3954085 100644 --- a/tests/jsinj.ur +++ b/tests/jsinj.ur @@ -13,6 +13,13 @@ fun colorToString c = val show_color = mkShow colorToString +datatype list a = Nil | Cons of a * list a + +fun delist ls : xbody = + case ls of + Nil => <xml>Nil</xml> + | Cons (h, t) => <xml>{cdata h} :: {delist t}</xml> + cookie int : int cookie float : float cookie string : string @@ -20,6 +27,7 @@ cookie bool : bool cookie pair : int * float cookie option : option int cookie color : color +cookie list : list string fun main () : transaction page = n <- getCookie int; @@ -50,6 +58,10 @@ fun main () : transaction page = c <- return (getOpt c White); sc <- source Blue; + l <- getCookie list; + l <- return (getOpt l (Cons ("A", Cons ("B", Nil)))); + sl <- source Nil; + return <xml><body> <dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/> <a onclick={set sn n}>CHANGE</a><br/> @@ -73,4 +85,7 @@ fun main () : transaction page = <dyn signal={c <- signal sc; return <xml>{[c]}</xml>}/> <a onclick={set sc c}>CHANGE</a><br/> + + <dyn signal={l <- signal sl; return <xml>{delist l}</xml>}/> + <a onclick={set sl l}>CHANGE</a><br/> </body></xml> |