Mercurial > urweb
comparison tests/jscomp.ur @ 973:e30c2409c9d0
More interpreter debugging
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 22 Sep 2009 13:41:23 -0400 |
parents | 733f67bb64e7 |
children | b851675a2c3d |
comparison
equal
deleted
inserted
replaced
972:733f67bb64e7 | 973:e30c2409c9d0 |
---|---|
1 fun fst [a] [b] (x : a) (y : b) = x | |
2 fun snd [a] [b] (x : a) (y : b) = y | |
3 | |
1 fun main () = | 4 fun main () = |
2 s <- source ""; | 5 s <- source ""; |
3 f <- source (plus 1); | 6 s' <- source ""; |
7 f <- source (plus 1); | |
8 f2 <- source fst; | |
9 r <- source {A = "x", B = "y"}; | |
4 | 10 |
5 return <xml><body> | 11 return <xml><body> |
6 <ctextbox source={s}/><br/><br/> | 12 <ctextbox source={s}/> <ctextbox source={s'}/><br/><br/> |
7 | 13 |
8 Function: <button value="+1" onclick={set f (plus 1)}/> | 14 Function: <button value="+1" onclick={set f (plus 1)}/> |
9 <button value="*3" onclick={set f (times 3)}/><br/><br/> | 15 <button value="*3" onclick={set f (times 3)}/><br/><br/> |
10 | 16 |
17 Function2: <button value="Fst" onclick={set f2 fst}/> | |
18 <button value="Snd" onclick={set f2 snd}/><br/><br/> | |
19 | |
11 <button value="Echo" onclick={s <- get s; alert s}/> | 20 <button value="Echo" onclick={s <- get s; alert s}/> |
21 <button value="-" onclick={s <- get s; alert (show (-(readError s : int)))}/> | |
12 <button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/> | 22 <button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/> |
13 <button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/> | 23 <button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/> |
14 <button value="f" onclick={s <- get s; f <- get f; alert (show (f (readError s)))}/> | 24 <button value="f" onclick={s <- get s; f <- get f; alert (show (f (readError s)))}/><br/><br/> |
25 | |
26 <button value="f2" onclick={s <- get s; s' <- get s'; f2 <- get f2; alert (f2 s s')}/><br/><br/> | |
27 | |
28 <button value="A" onclick={r <- get r; alert r.A}/> | |
29 <button value="B" onclick={r <- get r; alert r.B}/> | |
15 </body></xml> | 30 </body></xml> |