<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 24, 2015 at 5:01 PM, Richard Eisenberg wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":6tf" class="" style="overflow:hidden">I've been wanting to get warnings on partial functions (and partial record accessors, while we're at it!) for some time.<br>
<br>
And, I think it would be quite easy to have GHC infer partiality. As far as I can see, partiality can come from only two places: the use of a partial function, and an incomplete pattern match.</div></blockquote><div><br></div><div>Are `error` and `undefined` considered partial functions, or do they need to be marked as such? (Or is raise# considered a partial function?) What about FFI functions? Are there other primitives that need to be marked as partial?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":6tf" class="" style="overflow:hidden">(I'm ignoring nontermination here, which I think is best considered separately.) Before getting this into GHC, though, we'd need to make sure the incomplete-pattern-match checker is up for it (see #3927), but that work is being done right now. And we'd definitely need a way for users to declare "This function is total! Really!"<br>
<br>
I like the idea of user-specified warning categories, but I think partiality is easy enough for GHC to infer that it should be built in.</div></blockquote></div><br>I like the idea of inferring partiality, but I'm not convinced we can rely on that alone. Perhaps we need a pragma to indicate partiality where it can't be inferred. Also, it might be useful to be able to put a warning on partial function to indicate that (1) yes, we know that function is partial, but (2) no, we're not going to do anything about, and (3) we don't want to turn off partiality warnings for the rest of the module.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra">Sean</div></div>