Re: [Haskell-cafe] out-commented code vs. case with redundant pattern matches

Henning, how about putting the branches into their own variables. Admittedly this pollutes the namespace but is much more readable IMHO. workflow = new_workflow where new_workflow = putStrLn "A" old_workflow = putStrLn "B" I suppose GHC complains neither about unused where clauses nor about unused top-level bindings. At least with GHCi 7.8.3 the above code produces no warnings. Olaf

On Wed, 29 Nov 2017, Olaf Klinke wrote:
Henning,
how about putting the branches into their own variables. Admittedly this pollutes the namespace but is much more readable IMHO.
workflow = new_workflow where new_workflow = putStrLn "A" old_workflow = putStrLn "B"
I suppose GHC complains neither about unused where clauses nor about unused top-level bindings. At least with GHCi 7.8.3 the above code produces no warnings.
It complains with -Wall, which is a good thing. But in this case I can suppress the warning individually by prepending an underscore.
participants (2)
-
Henning Thielemann
-
Olaf Klinke