Split the Id related functions out from Var into Id, document Var and some of Id
[ghc-hetmet.git] / compiler / stranal / WwLib.lhs
index 4254d35..e7bd24f 100644 (file)
@@ -1,7 +1,7 @@
 %
 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
 %
-\section[WwLib]{A library for the ``worker/wrapper'' back-end to the strictness analyser}
+\section[WwLib]{A library for the ``worker\/wrapper'' back-end to the strictness analyser}
 
 \begin{code}
 module WwLib ( mkWwBodies, mkWWstr, mkWorkerArgs ) where
@@ -23,7 +23,7 @@ import TysWiredIn     ( tupleCon )
 import Type
 import Coercion         ( mkSymCoercion, splitNewTypeRepCo_maybe )
 import BasicTypes      ( Boxity(..) )
-import Var              ( Var, isId )
+import Var              ( Var, isIdVar )
 import UniqSupply
 import Unique
 import Util            ( zipWithEqual, notNull )
@@ -44,7 +44,7 @@ Here's an example.  The original function is:
 \begin{verbatim}
 g :: forall a . Int -> [a] -> a
 
-g = /\ a -> \ x ys ->
+g = \/\ a -> \ x ys ->
        case x of
          0 -> head ys
          _ -> head (tail ys)
@@ -55,7 +55,7 @@ From this, we want to produce:
 -- wrapper (an unfolding)
 g :: forall a . Int -> [a] -> a
 
-g = /\ a -> \ x ys ->
+g = \/\ a -> \ x ys ->
        case x of
          I# x# -> $wg a x# ys
            -- call the worker; don't forget the type args!
@@ -63,7 +63,7 @@ g = /\ a -> \ x ys ->
 -- worker
 $wg :: forall a . Int# -> [a] -> a
 
-$wg = /\ a -> \ x# ys ->
+$wg = \/\ a -> \ x# ys ->
        let
            x = I# x#
        in
@@ -98,7 +98,7 @@ the unusable strictness-info into the interfaces.
 %*                                                                     *
 %************************************************************************
 
-@mkWwBodies@ is called when doing the worker/wrapper split inside a module.
+@mkWwBodies@ is called when doing the worker\/wrapper split inside a module.
 
 \begin{code}
 mkWwBodies :: Type                             -- Type of original function
@@ -127,12 +127,12 @@ mkWwBodies fun_ty demands res_info one_shots = do
         -- Don't do CPR if the worker doesn't have any value arguments
         -- Then the worker is just a constant, so we don't want to unbox it.
     (wrap_fn_cpr, work_fn_cpr,  _cpr_res_ty)
-       <- if any isId work_args then
+       <- if any isIdVar work_args then
              mkWWcpr res_ty res_info
           else
              return (id, id, res_ty)
 
-    return ([idNewDemandInfo v | v <- work_call_args, isId v],
+    return ([idNewDemandInfo v | v <- work_call_args, isIdVar v],
               Note InlineMe . wrap_fn_args . wrap_fn_cpr . wrap_fn_str . applyToVars work_call_args . Var,
               mkLams work_lam_args. work_fn_str . work_fn_cpr . work_fn_args)
         -- We use an INLINE unconditionally, even if the wrapper turns out to be
@@ -170,7 +170,7 @@ mkWorkerArgs :: [Var]
             -> ([Var], -- Lambda bound args
                 [Var]) -- Args at call site
 mkWorkerArgs args res_ty
-    | any isId args || not (isUnLiftedType res_ty)
+    | any isIdVar args || not (isUnLiftedType res_ty)
     = (args, args)
     | otherwise        
     = (args ++ [voidArgId], args ++ [realWorldPrimId])
@@ -278,7 +278,7 @@ applyToVars vars fn = mkVarApps fn vars
 
 mk_wrap_arg :: Unique -> Type -> NewDemand.Demand -> Bool -> Id
 mk_wrap_arg uniq ty dmd one_shot 
-  = set_one_shot one_shot (setIdNewDemandInfo (mkSysLocal FSLIT("w") uniq ty) dmd)
+  = set_one_shot one_shot (setIdNewDemandInfo (mkSysLocal (fsLit "w") uniq ty) dmd)
   where
     set_one_shot True  id = setOneShotLambda id
     set_one_shot False id = id
@@ -502,5 +502,5 @@ sanitiseCaseBndr :: Id -> Id
 sanitiseCaseBndr id = id `setIdInfo` vanillaIdInfo
 
 mk_ww_local :: Unique -> Type -> Id
-mk_ww_local uniq ty = mkSysLocal FSLIT("ww") uniq ty
+mk_ww_local uniq ty = mkSysLocal (fsLit "ww") uniq ty
 \end{code}