Discussion:
Proposal: Add HasCallStack to the partial functions in base
Daniel Cartwright
2018-09-28 01:20:21 UTC
Permalink
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
Vanessa McHale
2018-09-28 01:31:30 UTC
Permalink
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?
Post by 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
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Daniel Cartwright
2018-09-28 01:32:47 UTC
Permalink
"etc." Means anything else that might be applicable, I just listed 3 off
the top of my head.
Post by 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?
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
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
David Feuer
2018-09-28 01:33:07 UTC
Permalink
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.
Post by 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
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Henning Thielemann
2018-09-28 05:25:32 UTC
Permalink
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.

Loading...