[GHC] #15559: fromJust has no HasCallStack

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.1 Component: Core | Version: 8.4.3 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The function `Data.Maybe.fromJust` does not have a `HasCallStack` constraint. I wonder why – is that intentional, or did just nobody bother yet? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: gridaphobe (added) Comment: When `HasCallStack` was introduced we intentionally did not introduce constraints to partial functions, no matter how small. IIRC this was in part because we expected third-party libraries to fill this need and in part it was out of concern for performance (since you would incur the cost of an additional argument, and potentially allocation, if the function isn't inlined). However, at this point it seems like `HasCallStack` is pretty well-accepted. It seems to me that we could start considering slowly adding `HasCallStack`s around in functions that are either (a) nearly certain to inline, or (b) not performance critical. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by gridaphobe): There were also concerns about API stability, particularly since the original implementation exposed the implicit parameter. Now that we have the `HasCallStack` alias and a decent set of API functions around it, we could swap out the implementation, if necessary, with less potential for client breakage. I'd support starting to add `HasCallStack` constraints to common partial functions like `fromJust`, `head`, etc. Though, is this something that should be discussed with the Core Libraries Committee? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ulysses4ever): Does it make sense to mark it `newcomer`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => newcomer Comment: Sure, this seems like a good task for a newcomer. However, I should emphasize to that we don't want to simply scatter `HasCallStack`s on every partial function. We should be thoughtful and deliberate (and probably consult with the CLC) when making changes like this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I really like GHC's internal `HasDebugCallStack`, which disappears (that is, becomes `()`) when `DEBUG` is not defined via CPP and becomes `HasCallStack` when `DEBUG` is defined. As far as I know, there's no standard way to mark a build meant for debugging, but perhaps there should be. Then, we could do the same for all applications instead of just GHC. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

I really like GHC's internal HasDebugCallStack, which disappears (that is, becomes ()) when DEBUG is not defined via CPP and becomes HasCallStack when DEBUG is defined. As far as I know, there's no standard way to mark a build meant for debugging, but perhaps there should be. Then, we could do
#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by chessai): the same for all applications instead of just GHC. In addition to making this available to users of GHC, there should probably be an additional side-effect to the DEBUG flag, or a separate flag, that turns HasDebugCallStack on for all functions -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): We already have a [[http://downloads.haskell.org/~ghc/master/users-guide //using-optimisation.html?highlight=assert#ghc-flag--fignore-asserts|very similar]] mechanism for `Control.Exception.assert` occurrences at compile- time. It would be reasonably straightforward to add a similar flag for a magic synonym of `HasCallStack`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D5256 Wiki Page: | -------------------------------------+------------------------------------- Changes (by fangyizhou): * status: new => patch * differential: => D5256 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5256 Wiki Page: | -------------------------------------+------------------------------------- Changes (by potato44): * differential: D5256 => Phab:D5256 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: (none)
Type: feature request | Status: patch
Priority: normal | Milestone: 8.6.1
Component: Core Libraries | Version: 8.4.3
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D5256
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.3 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5256 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: fangyizhou may look into proposing adding more `HasCallStack`s elsewhere but this one is finished. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15559: fromJust has no HasCallStack -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.8.1 Component: Core Libraries | Version: 8.4.3 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5256 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.6.1 => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15559#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC