Wouldn't this be best implemented with associated types?