import CoreUnfold ( couldBeSmallEnoughToInline )
import Var ( Id )
import VarEnv
-import UniqFM ( ufmToList )
import Outputable
+import Util ( notNull )
\end{code}
This module walks over @Core@, and looks for @case@ on free variables.
initEnv :: Int -> LibCaseEnv
initEnv bomb_size = LibCaseEnv bomb_size 0 emptyVarEnv emptyVarEnv []
-pprEnv :: LibCaseEnv -> SDoc
-pprEnv (LibCaseEnv _ lvl lvl_env _ scruts)
- = vcat [text "LibCaseEnv" <+> int lvl,
- fsep (map ppr (ufmToList lvl_env)),
- fsep (map ppr scruts)]
-
bombOutSize (LibCaseEnv bomb_size _ _ _ _) = bomb_size
\end{code}
libCaseId :: LibCaseEnv -> Id -> CoreExpr
libCaseId env v
| Just the_bind <- lookupRecId env v -- It's a use of a recursive thing
- , not (null free_scruts) -- with free vars scrutinised in RHS
+ , notNull free_scruts -- with free vars scrutinised in RHS
= Let the_bind (Var v)
| otherwise