Hint `case` instead of `let` outdated in favour of bang patterns?
Is the advice "case
instead of let
" in the user guide still up-to-date?
https://gitlab.haskell.org/ghc/ghc/-/blob/ad28ae41206e3a8b483b067a8e3333df445010b6/docs/users_guide/hints.rst#L175-190
A less contrived example shows the use of
cases
instead oflets
to get stricter code (a good thing):
f (Wibble x y) # beautiful but slow
= let
(a1, b1, c1) = unpackFoo x
(a2, b2, c2) = unpackFoo y
in ...
f (Wibble x y) # ugly, and proud of it
= case (unpackFoo x) of { (a1, b1, c1) ->
case (unpackFoo y) of { (a2, b2, c2) ->
...
}}
Wouldn't one use bang-patterns instead nowadays, rather than uglifying the code?