Revamp `Type.hs` with the new API design.