Proposal: Add HasCallStack to the partial functions in base

I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc. Relevant discussion here: https://ghc.haskell.org/trac/ghc/ticket/15559

What does "etc." mean? The linked ticket suggests that not all such functions would be candidates. I can't imagine fromJust, fromRight, or fromLeft being used in performance-critical code, so perhaps those would be a good start? On 09/27/2018 08:20 PM, Daniel Cartwright wrote:
I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc.
Relevant discussion here: https://ghc.haskell.org/trac/ghc/ticket/15559
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

"etc." Means anything else that might be applicable, I just listed 3 off
the top of my head.
On Thu, Sep 27, 2018, 8:31 PM Vanessa McHale
What does "etc." mean? The linked ticket suggests that not all such functions would be candidates.
I can't imagine fromJust, fromRight, or fromLeft being used in performance-critical code, so perhaps those would be a good start?
On 09/27/2018 08:20 PM, Daniel Cartwright wrote:
I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc.
Relevant discussion here: https://ghc.haskell.org/trac/ghc/ticket/15559
_______________________________________________ Libraries mailing listLibraries@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

I mostly think this is a good idea. However, some care is required to
prevent performance problems, especially in recursive functions. Watch out
in implementation! Also, these partial functions are sometimes used in
non-obviously total contexts, such as the implementation of mfix for lists.
We should refrain from introducing code bloat for nothing.
On Thu, Sep 27, 2018, 9:20 PM Daniel Cartwright
I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc.
Relevant discussion here: https://ghc.haskell.org/trac/ghc/ticket/15559 _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

On Thu, 27 Sep 2018, David Feuer wrote:
I mostly think this is a good idea. However, some care is required to prevent performance problems, especially in recursive functions. Watch out in implementation! Also, these partial functions are sometimes used in non-obviously total contexts, such as the implementation of mfix for lists.
All partial functions must eventually be used in total contexts - otherwise your program can crash.
participants (4)
-
Daniel Cartwright
-
David Feuer
-
Henning Thielemann
-
Vanessa McHale