view tests/case.ur @ 1533:75d77fbe7c94

Distribute applications of "arrow type" ECase across branches.
author Karn Kallio <kkallio@eka>
date Fri, 12 Aug 2011 00:55:57 -0430
parents 71bafe66dbe1
children
line wrap: on
line source
datatype t = A | B

val swap = fn x : t => case x of A => B | B => A

datatype u = C of t | D

val out = fn x : u => case x of C y => y | D => A

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))