summaryrefslogtreecommitdiff
path: root/compiler/stranal/DmdAnal.lhs
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2013-12-09 14:36:25 +0000
committerJoachim Breitner <mail@joachim-breitner.de>2013-12-09 15:42:09 +0000
commitf64cf134336820cc98fa45578400d9c9606fa8dc (patch)
tree3b678634c133249df8f4e50dcf63e7657d458d06 /compiler/stranal/DmdAnal.lhs
parenta31cb5b07726f5739f6eac35cbb348fcd2d6b598 (diff)
downloadhaskell-f64cf134336820cc98fa45578400d9c9606fa8dc.tar.gz
Rename topDmdType to nopDmdType
because topDmdType is ''not'' the top of the lattice, as it puts an implicit absent demand on free variables, but Abs is the bottom of the Usage lattice. Why nopDmdType? Becuase it is the demand of doing nothing: Everything lazy, everything absent, no definite divergence.
Diffstat (limited to 'compiler/stranal/DmdAnal.lhs')
-rw-r--r--compiler/stranal/DmdAnal.lhs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index cadc04c315..2b4a6b1f4c 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -124,9 +124,9 @@ dmdAnal :: AnalEnv
-- The CleanDemand is always strict and not absent
-- See Note [Ensure demand is strict]
-dmdAnal _ _ (Lit lit) = (topDmdType, Lit lit)
-dmdAnal _ _ (Type ty) = (topDmdType, Type ty) -- Doesn't happen, in fact
-dmdAnal _ _ (Coercion co) = (topDmdType, Coercion co)
+dmdAnal _ _ (Lit lit) = (nopDmdType, Lit lit)
+dmdAnal _ _ (Type ty) = (nopDmdType, Type ty) -- Doesn't happen, in fact
+dmdAnal _ _ (Coercion co) = (nopDmdType, Coercion co)
dmdAnal env dmd (Var var)
= (dmdTransform env var dmd, Var var)
@@ -338,6 +338,8 @@ dmdAnalAlt env dmd (con,bndrs,rhs)
final_alt_ty | io_hack_reqd = deferAfterIO alt_ty
| otherwise = alt_ty
+ -- Note [IO hack in the demand analyser]
+ --
-- There's a hack here for I/O operations. Consider
-- case foo x s of { (# s, r #) -> y }
-- Is this strict in 'y'. Normally yes, but what if 'foo' is an I/O
@@ -1069,7 +1071,7 @@ getStrictness :: AnalEnv -> Id -> StrictSig
getStrictness env fn
| isGlobalId fn = idStrictness fn
| Just (sig, _) <- lookupSigEnv env fn = sig
- | otherwise = topSig
+ | otherwise = nopSig
addInitialSigs :: TopLevelFlag -> AnalEnv -> [Id] -> AnalEnv
-- See Note [Initialising strictness]