Properly compute types for data constructors and record selectors