<p dir="ltr">We could also automatically detect basic partiality, like incomplete pattern matches, and add partiality warnings. Depending on how much work that is, it may be easier than trying to mark up all of base correctly.</p>
<br><div class="gmail_quote">On Tue, Feb 24, 2015, 1:29 PM Joachim Breitner <<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Am Dienstag, den 24.02.2015, 11:33 +0100 schrieb Henning Thielemann:<br>
> On Tue, 24 Feb 2015, Joachim Breitner wrote:<br>
><br>
> > If you would continue this thought of line towards some consistency,<br>
> > then we’d need a way to annotate partial functions in general, and have<br>
> > a dedicated flag -fwarn-partial-functions. (It would behave just like<br>
> > deprecations – but reported separately.).  This would go well with<br>
> > -fwarn-incomplete-patterns. Such a thing might be useful.<br>
><br>
> I have thought about it in the past and it is certainly better than no<br>
> such warning. On the other hand partiality can be caused by infinite loops<br>
> and is then hard to detect. To be completely sure you would have to<br>
> implement a termination checker as in liquid-haskell. Nonetheless, a<br>
> partiality marker for every function that might call 'error' or<br>
> 'undefined' would be useful.<br>
<br>
note that I am not proposing that GHC would figure out what is total and<br>
what not, but simply that you could say<br>
<br>
fromJust :: Maybe a -> a<br>
fromJust (Just a) = a<br>
{-# WARNING (partial) fromJust "fromJust is partial #-}<br>
<br>
and the user will see the warnings if he enables -fwarn-partial. If no<br>
such annotation is given, no warning is printed.<br>
<br>
A proper totally checker would be a whole different beast :-)<br>
<br>
(Note that here, I am inventing a syntax to categorize the warnings into<br>
groups, so that the user can choose whether to see partiality warnings<br>
or not independently from other uses of WARNING.)<br>
<br>
Greetings,<br>
Joachim<br>
<br>
--<br>
Joachim “nomeata” Breitner<br>
  <a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a> • <a href="http://www.joachim-breitner.de/" target="_blank">http://www.joachim-breitner.<u></u>de/</a><br>
  Jabber: <a href="mailto:nomeata@joachim-breitner.de" target="_blank">nomeata@joachim-breitner.de</a>  • GPG-Key: 0xF0FBF51F<br>
  Debian Developer: <a href="mailto:nomeata@debian.org" target="_blank">nomeata@debian.org</a><br>
<br>
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-<u></u>bin/mailman/listinfo/libraries</a><br>
</blockquote></div>