In defining multiple pattern matches for a function, for instance as follows:
1: takeTree 0 tree = Leaf
2: takeTree levels (Leaf) = Leaf
3: takeTree levels (Branch value left right) = Branch value (takeTree...
I get two warnings in particular:
Source.hs:1: Warning: Defined but not used: `tree'
Source.hs:2: Warning: Defined but not used: `levels'
I'm not immediately convinced these are useful warnings though. If my code were instead:
1: takeTree 0 _ = Leaf
2: takeTree _ (Leaf) = Leaf
3: takeTree levels (Branch value left right) = Branch value (takeTree...
which, fixes the warnings, I now find it to be far less readable, and obfuscates the semantics of what I expect as input values.
Why is Defined but not used
a reasonable warning at all here, when among my exhaustive patterns each argument is in fact used at least once?