[commit: ghc] master: Tiny refactor; use guards instead of 'if' (f6b98ea)

git at git.haskell.org git at git.haskell.org
Mon Feb 15 16:20:14 UTC 2016


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

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

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

commit f6b98ea75d56e479248643d413676a13f357b705
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Feb 15 15:49:41 2016 +0000

    Tiny refactor; use guards instead of 'if'


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

f6b98ea75d56e479248643d413676a13f357b705
 compiler/types/Type.hs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index 67365e3..1266b66 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -1237,13 +1237,13 @@ mkPiTypesPreferFunTy :: [TyVar] -> Type -> Type
 mkPiTypesPreferFunTy vars inner_ty = fst $ go vars inner_ty
   where
     go :: [TyVar] -> Type -> (Type, VarSet) -- also returns the free vars
-    go [] ty = (ty, tyCoVarsOfType ty)
-    go (v:vs) ty
-      = if v `elemVarSet` fvs
-        then ( mkForAllTy (Named v Visible) qty
-             , fvs `delVarSet` v `unionVarSet` kind_vars )
-        else ( mkForAllTy (Anon (tyVarKind v)) qty
-             , fvs `unionVarSet` kind_vars )
+    go []     ty = (ty, tyCoVarsOfType ty)
+    go (v:vs) ty | v `elemVarSet` fvs
+                 = ( mkForAllTy (Named v Visible) qty
+                   , fvs `delVarSet` v `unionVarSet` kind_vars )
+                 | otherwise
+                 = ( mkForAllTy (Anon (tyVarKind v)) qty
+                   , fvs `unionVarSet` kind_vars )
       where
         (qty, fvs) = go vs ty
         kind_vars  = tyCoVarsOfType $ tyVarKind v



More information about the ghc-commits mailing list