
On Sun, Dec 29, 2024 at 01:32:48PM -0800, amindfv--- via Haskell-Cafe wrote:
On Mon, Dec 30, 2024 at 07:32:01AM +1100, Viktor Dukhovni wrote:
On Sun, Dec 29, 2024 at 12:13:35PM -0800, Ivan Perez wrote:
Wrt otherwise, yes, I also found that a bit confusing.
Well, it isn't that confusing, it is a boolean function that has never been tested well enough to observe the effect of it returning False. :-) It is slightly surprising when first observed, but clear enough why this was flagged.
It's clear enough why this would happen, but it's serving the compiler, not the user.
I don't entirely disagree, though I also learned something useful (that is perhaps after the fact obvious, but only with some experience) from "otherwise" being flagged, which is that HPC covers evaluatio of expressions, not just execution of lines of code, and that for expressions that are branch heads it also checks whether both paths are taken. ... So it was educational (the first time). One of course nowdays define: patten Else :: Bool pattern Else = True and use "Else" instead of otherwise, and then perhaps the impossible branch not taken would not be flagged?
Here's another annoying example:
main :: IO () main = do _ <- foo pure ()
The unit ("()") is marked as "never executed" and highlighted in yellow, and expression coverage falls below 100%. While that may literally be true, this falls - for the programmer just trying to get something done - under the category of "why am I looking at this?"
HPC is a great tool and a few human-aware improvements could really help quality of life (and HPC's adoption, imo).
I really like HPC. But sure, some twkeaks might go a long way. -- Viktor.