WIP: partway through fixing type errors for GHC 7.8