Using lists to implement union types