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

Henning Thielemann lemming at henning-thielemann.de
Wed Nov 29 19:13:19 UTC 2017


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.


More information about the Haskell-Cafe mailing list