data Tree k = Leaf { key :: k } | Branch { left :: Tree k , right :: Tree k }
interface Tree<K> { } class Leaf<K> implements Tree<K> { Leaf(E key) { .. } } class Branch<K> implements Tree<K> { Branch(Tree<K> left, Tree<K> right) { .. } }