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 | 4b109c964ac7f433b4feb9d28b135dee28f75b87 (patch) | |
tree | 222afdcae4c1001350fc852d989430730a0efdbf /tests | |
parent | 21118ae45de71e6d1c144064ed09d136466d8a4f (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> |