diff options
author | Tobias Dammers <tdammers@gmail.com> | 2018-03-29 10:45:54 +0200 |
---|---|---|
committer | Tobias Dammers <tdammers@gmail.com> | 2018-04-04 09:45:07 +0200 |
commit | 87c547dea0620d92f552275eaa39135bdd4e0423 (patch) | |
tree | 00b365ac7e890da48530a29a3ffba63ef56af2f8 | |
parent | 5d1a707c6c78dedc915604aec702d07c4bc741c5 (diff) | |
download | haskell-87c547dea0620d92f552275eaa39135bdd4e0423.tar.gz |
Improve isReflexiveCo performance
-rw-r--r-- | compiler/types/Coercion.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 7a7918c250..c0532332cf 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -376,7 +376,9 @@ isReflCo_maybe _ = Nothing -- | Slowly checks if the coercion is reflexive. Don't call this in a loop, -- as it walks over the entire coercion. isReflexiveCo :: Coercion -> Bool -isReflexiveCo = isJust . isReflexiveCo_maybe +isReflexiveCo (Refl {}) = True +isReflexiveCo co = eqType ty1 ty2 + where Pair ty1 ty2 = coercionKind co -- | Extracts the coerced type from a reflexive coercion. This potentially -- walks over the entire coercion, so avoid doing this in a loop. |