Commit be3b84f3 authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski
Browse files


parent e19ae5df
......@@ -388,13 +388,13 @@ is fine, and has type Bool. This is one reason we need a type on
the case expression: if the alternatives are empty we can't get the type
from the alternatives! I'll write this
case (error Int "Hello") of Bool {}
with the return type just before the alterantives.
with the return type just before the alternatives.
Here's another example:
data T
f :: T -> Bool
f = \(x:t). case x of Bool {}
Since T has no data constructors, the case alterantives are of course
Since T has no data constructors, the case alternatives are of course
empty. However note that 'x' is not bound to a visbily-bottom value;
it's the *type* that tells us it's going to diverge. Its a bit of a
degnerate situation but we do NOT want to replace
......@@ -695,7 +695,7 @@ Should we inline 'v' at its use site inside the loop? At the moment
we do. I experimented with saying that case are *not* work-free, but
that increased allocation slightly. It's a fairly small effect, and at
the moment we go for the slightly more aggressive version which treats
(case x of ....) as work-free if the alterantives are.
(case x of ....) as work-free if the alternatives are.
Note [exprIsCheap] See also Note [Interaction of exprIsCheap and lone variables]
......@@ -984,7 +984,7 @@ app_ok primop_ok fun args
altsAreExhaustive :: [Alt b] -> Bool
-- True <=> the case alterantives are definiely exhaustive
-- True <=> the case alternatives are definiely exhaustive
-- False <=> they may or may not be
altsAreExhaustive []
= False -- Should not happen
......@@ -828,7 +828,7 @@ rnMatch' ctxt rnBody match@(Match pats maybe_rhs_sig grhss)
; return (Match pats' Nothing grhss', grhss_fvs) }}
emptyCaseErr :: HsMatchContext Name -> SDoc
emptyCaseErr ctxt = hang (ptext (sLit "Empty list of alterantives in") <+> pp_ctxt)
emptyCaseErr ctxt = hang (ptext (sLit "Empty list of alternatives in") <+> pp_ctxt)
2 (ptext (sLit "Use EmptyCase to allow this"))
pp_ctxt = case ctxt of
......@@ -206,8 +206,8 @@ rnImportDecl this_mod
(warnRedundantSourceImport imp_mod_name)
when (mod_safe && not (safeImportsOn dflags)) $
addErrAt loc (ptext (sLit "safe import can't be used as Safe Haskell isn't on!")
$+$ ptext (sLit $ "please enable Safe Haskell through either"
++ "Safe, Trustwrothy or Unsafe"))
$+$ ptext (sLit $ "please enable Safe Haskell through either "
++ "Safe, Trustworthy or Unsafe"))
let imp_mod = mi_module iface
warns = mi_warns iface
......@@ -1553,7 +1553,7 @@ prepareAlts scrut case_bndr' alts
_ -> []
Note [Combine identical alterantives]
Note [Combine identical alternatives]
If several alternatives are identical, merge them into
a single DEFAULT alternative. I've occasionally seen this
......@@ -1598,7 +1598,7 @@ defeats combineIdenticalAlts (see Trac #7360).
combineIdenticalAlts :: OutId -> [InAlt] -> SimplM [InAlt]
-- See Note [Combine identical alterantives]
-- See Note [Combine identical alternatives]
combineIdenticalAlts case_bndr ((_con1,bndrs1,rhs1) : con_alts)
| all isDeadBinder bndrs1 -- Remember the default
, length filtered_alts < length con_alts -- alternative comes first
......@@ -831,7 +831,7 @@ Notice that j' is not a let-no-escape any more.
However this means in turn that the *enclosing* function
may be CPR'd (via the returned Justs). But in the case of
sums, there may be Nothing alterantives; and that messes
sums, there may be Nothing alternatives; and that messes
up the sum-type CPR.
Conclusion: only do this for products. It's still not
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment