Proposal: Add HasCallStack to the partial functions in base

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: Add HasCallStack to the partial functions in base

Daniel Cartwright
I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc.


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Add HasCallStack to the partial functions in base

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.



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Add HasCallStack to the partial functions in base

Daniel Cartwright
"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 <[hidden email]> wrote:

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.



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Add HasCallStack to the partial functions in base

David Feuer
In reply to this post by Daniel Cartwright
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 <[hidden email]> wrote:
I propose to add `HasCallStack` to all partial functions in base, e.g. `fromJust`, `fromRight`, `fromLeft`, etc.

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Add HasCallStack to the partial functions in base

Henning Thielemann

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.
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries