[Haskell-cafe] Redundant/overlapping patterns?

David Fox dsf at seereason.com
Sat Jul 22 21:26:27 UTC 2023


On Fri, Jul 21, 2023 at 5:14 PM Todd Wilson <twilson at csufresno.edu> wrote:

> On Fri, Jul 21, 2023 at 3:27 PM Jeff Clites via Haskell-Cafe <
> haskell-cafe at haskell.org> wrote:
>
>> Oh no I take that back, it is talking about a specific pattern:
>>
>> >>    Pattern match is redundant
>> >>    In a case alternative: B -> ...
>>
>> But I do think a better complaint is that you don't need a case
>> expression there at all, but it seems like that's not actually what it's
>> complaining about. Hmm.
>>
>
> My take-away from all this is that, if a case branch can be determined
> *statically* (i.e., without applying any evaluation steps) not to match,
> then it is "redundant." If there are counterexamples to this take-away,
> though, please let me know!
>
> --Todd
>
> At the risk of descending into bikeshedding, I think "redundant" applies
to anything that can be safely removed, and it is widely used in the ghc
error messages.  Using different words like "unreachable"  and
"unnecessary" is distracting and doesn't confer any benefit that I can see.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230722/90c6f5b1/attachment.html>


More information about the Haskell-Cafe mailing list