trying to find a general way to define bi-directional type hierarchies