Refactor Type.hs.