[commit: ghc] master: Simplify the defn of coreViewOneStarKind (21b4228)
git at git.haskell.org
git at git.haskell.org
Wed Feb 17 14:36:55 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/21b4228d750198bdcac8d68d13892cc960d6881f/ghc
>---------------------------------------------------------------
commit 21b4228d750198bdcac8d68d13892cc960d6881f
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Feb 17 14:36:49 2016 +0000
Simplify the defn of coreViewOneStarKind
I discussed it with Richard, but this version is much
simmpler and more efficient.
>---------------------------------------------------------------
21b4228d750198bdcac8d68d13892cc960d6881f
compiler/types/Type.hs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index 1266b66..36da3a1 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -311,12 +311,11 @@ coreView _ = Nothing
-- | Like 'coreView', but it also "expands" @Constraint@ to become
-- @TYPE Lifted at .
coreViewOneStarKind :: Type -> Maybe Type
-coreViewOneStarKind = go Nothing
- where
- go _ t | Just t' <- coreView t = go (Just t') t'
- go _ (TyConApp tc []) | isStarKindSynonymTyCon tc = go (Just t') t'
- where t' = liftedTypeKind
- go res _ = res
+coreViewOneStarKind ty
+ | Just ty' <- coreView ty = Just ty'
+ | TyConApp tc [] <- ty
+ , isStarKindSynonymTyCon tc = Just liftedTypeKind
+ | otherwise = Nothing
-----------------------------------------------
expandTypeSynonyms :: Type -> Type
More information about the ghc-commits
mailing list