[commit: ghc] master: Use tyConArity rather than (length tvs) (aea1e5d)

git at git.haskell.org git at git.haskell.org
Wed Mar 2 15:22:56 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/aea1e5dbfd841edf546e789df496e77389d26f65/ghc

>---------------------------------------------------------------

commit aea1e5dbfd841edf546e789df496e77389d26f65
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Mar 2 15:22:46 2016 +0000

    Use tyConArity rather than (length tvs)
    
    A bit more efficient


>---------------------------------------------------------------

aea1e5dbfd841edf546e789df496e77389d26f65
 compiler/types/TyCon.hs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index 5d01732..3c0a945 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



More information about the ghc-commits mailing list