Fix CodingStyle#Warnings URLs
[ghc-hetmet.git] / compiler / coreSyn / CoreTidy.lhs
index bacf64f..37c6cb3 100644 (file)
@@ -1,8 +1,19 @@
 %
+% (c) The University of Glasgow 2006
 % (c) The AQUA Project, Glasgow University, 1996-1998
 %
 
+This module contains "tidying" code for *nested* expressions, bindings, rules.
+The code for *top-level* bindings is in TidyPgm.
+
 \begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 module CoreTidy (
        tidyExpr, tidyVarOcc, tidyRule, tidyRules 
     ) where
@@ -10,26 +21,21 @@ module CoreTidy (
 #include "HsVersions.h"
 
 import CoreSyn
-import CoreUtils       ( exprArity )
-import Id              ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, idType )
-import IdInfo          ( setArityInfo, vanillaIdInfo,
-                         newStrictnessInfo, setAllStrictnessInfo,
-                         newDemandInfo, setNewDemandInfo )
-import Type            ( tidyType, tidyTyVarBndr )
-import Var             ( Var, varName )
+import CoreUtils
+import Id
+import IdInfo
+import Type
+import Var
 import VarEnv
-import UniqFM          ( lookupUFM )
-import Name            ( Name, getOccName )
-import OccName         ( tidyOccName )
-import SrcLoc          ( noSrcLoc )
-import Maybes          ( orElse )
-import Outputable
-import Util            ( mapAccumL )
-\end{code}
+import UniqFM
+import Name hiding (tidyNameOcc)
+import OccName
+import SrcLoc
+import Maybes
 
+import Data.List
+\end{code}
 
-This module contains "tidying" code for *nested* expressions, bindings, rules.
-The code for *top-level* bindings is in TidyPgm.
 
 %************************************************************************
 %*                                                                     *
@@ -115,7 +121,7 @@ tidyNameOcc :: TidyEnv -> Name -> Name
 -- Fortunately, we can lookup in the VarEnv with a name
 tidyNameOcc (_, var_env) n = case lookupUFM var_env n of
                                Nothing -> n
-                               Just v  -> varName v
+                               Just v  -> idName v
 
 tidyVarOcc :: TidyEnv -> Var -> Var
 tidyVarOcc (_, var_env) v = lookupVarEnv var_env v `orElse` v
@@ -148,13 +154,16 @@ tidyLetBndr env (id,rhs)
        -- CorePrep to turn the let into a case.
        --
        -- Similarly arity info for eta expansion in CorePrep
-       --
+       -- 
+       -- Set inline-prag info so that we preseve it across 
+       -- separate compilation boundaries
     final_id = new_id `setIdInfo` new_info
     idinfo   = idInfo id
     new_info = vanillaIdInfo
                `setArityInfo`          exprArity rhs
                `setAllStrictnessInfo`  newStrictnessInfo idinfo
                `setNewDemandInfo`      newDemandInfo idinfo
+               `setInlinePragInfo`     inlinePragInfo idinfo
 
     -- Override the env we get back from tidyId with the new IdInfo
     -- so it gets propagated to the usage sites.
@@ -175,7 +184,7 @@ tidyIdBndr env@(tidy_env, var_env) id
        -- which should save some space.
        -- But note that tidyLetBndr puts some of it back.
         ty'              = tidyType env (idType id)
-       id'               = mkUserLocal occ' (idUnique id) ty' noSrcLoc
+       id'               = mkUserLocal occ' (idUnique id) ty' noSrcSpan
                                `setIdInfo` vanillaIdInfo
        var_env'          = extendVarEnv var_env id id'
     in