[commit: ghc] master: simplCore: detabify/dewhitespace SAT (96c3599)

git at git.haskell.org git at git.haskell.org
Wed Aug 20 08:48:05 UTC 2014


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

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

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

commit 96c3599375d040b914d433cda97d532ff0aae3bc
Author: Austin Seipp <austin at well-typed.com>
Date:   Wed Aug 20 03:31:49 2014 -0500

    simplCore: detabify/dewhitespace SAT
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

96c3599375d040b914d433cda97d532ff0aae3bc
 compiler/simplCore/SAT.lhs | 70 ++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 39 deletions(-)

diff --git a/compiler/simplCore/SAT.lhs b/compiler/simplCore/SAT.lhs
index 92ebdfe..a0b3151 100644
--- a/compiler/simplCore/SAT.lhs
+++ b/compiler/simplCore/SAT.lhs
@@ -50,14 +50,6 @@ essential to make this work well!
 
 \begin{code}
 {-# LANGUAGE CPP #-}
-{-# OPTIONS_GHC -fno-warn-tabs #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and
--- detab the module (please do the detabbing in a separate patch). See
---     http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
--- for details
-
-
 module SAT ( doStaticArgs ) where
 
 import Var
@@ -112,7 +104,7 @@ satBind (Rec [(binder, rhs)]) interesting_ids = do
                         else sat_info_rhs'
 
     bind' <- saTransformMaybe binder (lookupUFM sat_info_rhs' binder)
-			      rhs_binders rhs_body'
+                              rhs_binders rhs_body'
     return (bind', sat_info_rhs'')
 satBind (Rec pairs) interesting_ids = do
     let (binders, rhss) = unzip pairs
@@ -298,13 +290,13 @@ to
     map :: forall a b. (a->b) -> [a] -> [b]
     map = /\ab. \(f:a->b) (as:[a]) ->
          letrec map' :: [a] -> [b]
-		    -- The "worker function
+                    -- The "worker function
                 map' = \(as:[a]) ->
-			 let map :: forall a' b'. (a -> b) -> [a] -> [b]
-				-- The "shadow function
-			     map = /\a'b'. \(f':(a->b) (as:[a]).
-				   map' as
-	                 in body[map]
+                         let map :: forall a' b'. (a -> b) -> [a] -> [b]
+                                -- The "shadow function
+                             map = /\a'b'. \(f':(a->b) (as:[a]).
+                                   map' as
+                         in body[map]
          in map' as
 
 Note [Shadow binding]
@@ -379,13 +371,13 @@ saTransformMaybe binder maybe_arg_staticness rhs_binders rhs_body
   where
     should_transform staticness = n_static_args > 1 -- THIS IS THE DECISION POINT
       where
-	n_static_args = length (filter isStaticValue staticness)
+        n_static_args = length (filter isStaticValue staticness)
 
 saTransform :: Id -> SATInfo -> [Id] -> CoreExpr -> SatM CoreBind
 saTransform binder arg_staticness rhs_binders rhs_body
-  = do	{ shadow_lam_bndrs <- mapM clone binders_w_staticness
-	; uniq	 	   <- newUnique
-	; return (NonRec binder (mk_new_rhs uniq shadow_lam_bndrs)) }
+  = do  { shadow_lam_bndrs <- mapM clone binders_w_staticness
+        ; uniq             <- newUnique
+        ; return (NonRec binder (mk_new_rhs uniq shadow_lam_bndrs)) }
   where
     -- Running example: foldr
     -- foldr \alpha \beta c n xs = e, for some e
@@ -394,43 +386,43 @@ saTransform binder arg_staticness rhs_binders rhs_body
     -- rhs_body = e
 
     binders_w_staticness = rhs_binders `zip` (arg_staticness ++ repeat NotStatic)
-					-- Any extra args are assumed NotStatic
+                                        -- Any extra args are assumed NotStatic
 
     non_static_args :: [Var]
-	    -- non_static_args = [xs]
-	    -- rhs_binders_without_type_capture = [\alpha', \beta', c, n, xs]
+            -- non_static_args = [xs]
+            -- rhs_binders_without_type_capture = [\alpha', \beta', c, n, xs]
     non_static_args = [v | (v, NotStatic) <- binders_w_staticness]
 
     clone (bndr, NotStatic) = return bndr
     clone (bndr, _        ) = do { uniq <- newUnique
-				 ; return (setVarUnique bndr uniq) }
+                                 ; return (setVarUnique bndr uniq) }
 
     -- new_rhs = \alpha beta c n xs ->
     --           let sat_worker = \xs -> let sat_shadow = \alpha' beta' c n xs ->
-    -- 					     sat_worker xs 
+    --                                       sat_worker xs
     --                                   in e
     --           in sat_worker xs
     mk_new_rhs uniq shadow_lam_bndrs
-	= mkLams rhs_binders $ 
-	  Let (Rec [(rec_body_bndr, rec_body)]) 
-	  local_body
-	where
-	  local_body = mkVarApps (Var rec_body_bndr) non_static_args
+        = mkLams rhs_binders $
+          Let (Rec [(rec_body_bndr, rec_body)])
+          local_body
+        where
+          local_body = mkVarApps (Var rec_body_bndr) non_static_args
 
-	  rec_body = mkLams non_static_args $
+          rec_body = mkLams non_static_args $
                      Let (NonRec shadow_bndr shadow_rhs) rhs_body
 
-	    -- See Note [Binder type capture]
-	  shadow_rhs = mkLams shadow_lam_bndrs local_body
-	    -- nonrec_rhs = \alpha' beta' c n xs -> sat_worker xs
+            -- See Note [Binder type capture]
+          shadow_rhs = mkLams shadow_lam_bndrs local_body
+            -- nonrec_rhs = \alpha' beta' c n xs -> sat_worker xs
 
-	  rec_body_bndr = mkSysLocal (fsLit "sat_worker") uniq (exprType rec_body)
-	    -- rec_body_bndr = sat_worker
+          rec_body_bndr = mkSysLocal (fsLit "sat_worker") uniq (exprType rec_body)
+            -- rec_body_bndr = sat_worker
 
-	    -- See Note [Shadow binding]; make a SysLocal
-	  shadow_bndr = mkSysLocal (occNameFS (getOccName binder)) 
-				   (idUnique binder)
-				   (exprType shadow_rhs)
+            -- See Note [Shadow binding]; make a SysLocal
+          shadow_bndr = mkSysLocal (occNameFS (getOccName binder))
+                                   (idUnique binder)
+                                   (exprType shadow_rhs)
 
 isStaticValue :: Staticness App -> Bool
 isStaticValue (Static (VarApp _)) = True



More information about the ghc-commits mailing list