diff options
author | Adam Chlipala <adamc@csail.mit.edu> | 2018-12-25 09:21:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-25 09:21:42 -0500 |
commit | d4620695ec44da55be046f9dee4caf1f29759943 (patch) | |
tree | 1b4ceeea0c028fb354fa28e29bb384d4bb8fc205 /tests/case.ur | |
parent | c9bb1becf98d02123666eb084de88a443e1a2544 (diff) | |
parent | 1a39672b01dc236068475e2d1a8a6f21814cba7e (diff) |
Merge pull request #152 from ashalkhakov/more-tests
More tests.
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> |