diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-02 15:22:46 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-02 15:24:51 +0000 |
commit | aea1e5dbfd841edf546e789df496e77389d26f65 (patch) | |
tree | 1580ce652ff2e3507ff1f7ebb008ac4ab3d80a19 | |
parent | 286dc021ef515d02453cd5e31774b852d3a1310f (diff) | |
download | haskell-aea1e5dbfd841edf546e789df496e77389d26f65.tar.gz |
Use tyConArity rather than (length tvs)
A bit more efficient
-rw-r--r-- | compiler/types/TyCon.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 5d017325cc..3c0a945c73 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1798,10 +1798,9 @@ expandSynTyCon_maybe -- ^ Expand a type synonym application, if any expandSynTyCon_maybe tc tys - | SynonymTyCon { tyConTyVars = tvs, synTcRhs = rhs } <- tc - , let n_tvs = length tvs - = case n_tvs `compare` length tys of - LT -> Just (tvs `zip` tys, rhs, drop n_tvs tys) + | SynonymTyCon { tyConTyVars = tvs, synTcRhs = rhs, tyConArity = arity } <- tc + = case arity `compare` length tys of + LT -> Just (tvs `zip` tys, rhs, drop arity tys) EQ -> Just (tvs `zip` tys, rhs, []) GT -> Nothing | otherwise |