RFC: Add HasCallStack constraint to partial Data.List functions.

Bryan Richter b at chreekat.net
Mon May 31 17:55:57 UTC 2021

I like this avenue of thought! I would suggest the following:

Step 1: Accept this proposal.

Step 2: Introduce more *educational* error messages in the exceptions.
Instead of "error: empty list", for example, it could be "error: unguarded
use of head has failed".

Sorry for phone-brevity.

On Mon, 31 May 2021, 19.31 Hécate, <hecate at glitchbra.in> wrote:

> I think the vast majority of the functions presented in this proposal have
> a total counterpart, whether it is a function or a code pattern. We have
> NonEmpty in `base`, as well as ExceptT/MonadError and Exceptions to allow
> us to mimic such a cul-de-sac in the code with appropriate annotations
> around it.
> Le 31/05/2021 à 18:15, Henning Thielemann a écrit :
> On Mon, 31 May 2021, Ryan Trinkle via Libraries wrote:
> I certainly agree that a more systemic solution would be preferable.
> However, none have been forthcoming in the 15 or so years I've been
> using Haskell.  The use of partial functions in library code has been
> one of the few consistent sources of multi-day debugging exercises in
> Haskell that I've seen, and even cutting that down in an ad-hoc way
> would be valuable, since there are probably a dozen functions that
> account for 80% of the debugging hours (I'd certainly like to see
> fromJust on that list, for example).
> I understand the proposal as tagging all partial functions in a compiler
> accessible way, in order to tell the user: Don't use that function!
> If so, then we should make sure that every such tagged function has a
> total counterpart.
> _______________________________________________
> Libraries mailing listLibraries at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> --
> Hécate ✨
> 🐦: @TechnoEmpress
> IRC: Hecate
> WWW: https://glitchbra.in
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20210531/fed2d488/attachment.html>

More information about the Libraries mailing list