Ticket #4930 (closed bug: fixed)
Case-of-case not eliminated when it could be
Description
Small example:
foo :: Int -> Int foo n = (if n < 5 then error "Too small" else n+2) `seq` n+5
GHC produces this:
foo =
\ (w_slQ :: Int) ->
case w_slQ of _ { I# ww_slT ->
case case <# ww_slT 5 of _ {
False -> case +# ww_slT 2 of sat_sm1 { __DEFAULT -> I# sat_sm1 };
True -> foo1
}
of _ { I# _ ->
case +# ww_slT 5 of sat_sm4 { __DEFAULT -> I# sat_sm4 }
}
}
It ought to produce something like this instead:
foo n = case n of I# n# ->
case n# <# 5 of
True -> foo1
False -> I# (n# +# 5)
Change History
Note: See
TracTickets for help on using
tickets.
