Proposal to deprecate and then drop fromJust

Sean Leather sean.leather at
Tue Feb 24 15:37:17 UTC 2015

On Tue, Feb 24, 2015 at 5:01 PM, Richard Eisenberg wrote:

> I've been wanting to get warnings on partial functions (and partial record
> accessors, while we're at it!) for some time.
> 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.

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

(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!"
> 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.

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list