> Note that
>
> case <foo>
> | [] -> ...
> | (_ : xs) -> ...
>
> also contains a wildcard-pattern. So emitting a warning for every use
> of wildcard patterns would likely lead to a lot of pain.
Yes, good point, that would be too restrictive. When I said wildcard-pattern I was thinking specifically of a top-level wildcard, so your example would be accepted, but e.g.
case ... of
[] -> ...
_ -> ...
would be rejected.
> You'd instead want to warn about "default branch", e.g.
>
> case <foo>
> | [] -> ...
> | (1 : xs) -> ...
> | (_ : xs) -> ...
>
> here the wildcard pattern does correspond to a "default branch" and
> might hence deserve a warning.
This sounds promising, but how would you define “default branch”? Seems like it could be an involved definition, which could make the warning unpredictable for users.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.