[Haskell-cafe] More death to partial functions: Should -fwarn-incomplete-uni-patterns be enabled with -Wall?

Joachim Breitner mail at joachim-breitner.de
Sun Nov 8 09:42:35 UTC 2015


Am Sonntag, den 08.11.2015, 09:30 +0000 schrieb Tom Ellis:
> Simon's code is inadvisable, in my opinion.  It is
>     f xs | null xs = blah
>          | otherwise = x+1
>          where
>            (x:_) = xs
> where it really should be
>     f xs = case xs of []    -> blah
>                       (x:_) -> x + 1

yes, in this particular, small example

But often you have complex decisions in the guards that are not
obviously related to the pattern match, and the where-bound and
partially-pattern-matched value are used in multiple branches of the


Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151108/a63c2962/attachment.sig>

More information about the Haskell-Cafe mailing list