diff options
Diffstat (limited to 'tests/case.ur')
-rw-r--r-- | tests/case.ur | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/case.ur b/tests/case.ur index b131b27b..a6f4c700 100644 --- a/tests/case.ur +++ b/tests/case.ur @@ -11,6 +11,22 @@ datatype nat = O | S of nat val is_two = fn x : nat => case x of S (S O) => A | _ => B -val zero_is_two = is_two O -val one_is_two = is_two (S O) -val two_is_two = is_two (S (S O)) +val shw = fn x : t => + case x of A => "A" | B => "B" + +fun main (): transaction page = return <xml><body> + <div> + <p>zero is two: {[shw (is_two O)]}</p> + <p>one is two: {[shw (is_two (S O))]}</p> + <p>two is two: {[shw (is_two (S (S O)))]}</p> + </div> + + <button onclick={fn _ => let + val m = + "zero is two: " ^ shw (is_two O) ^ "\n" ^ + "one is two: " ^ shw (is_two (S O)) ^ "\n" ^ + "two is two: " ^ shw (is_two (S (S O))) + in + alert m + end}>click me</button> +</body></xml> |