[GHC] #11787: Infer HasCallStack where possible

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 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: -------------------------------------+------------------------------------- Consider {{{ Prelude> :t error error :: GHC.Stack.Types.HasCallStack => [Char] -> a Prelude> :t (\x -> error x) (\x -> error x) :: (?callStack::GHC.Stack.Types.CallStack) => [Char] -> a }}} We would prefer to get the same type for the latter as the former. Moreover, when we execute on #11376 (comment 25), `:t error` will show the more complicated type too. My suggestion: during generalisation, when we see `?callStack::CallStack`, use the built-in type synonym `HasCallStack`. Note that this should only happen if the name used for the implicit parameter is actually `?callstack`. Eric would you like to consider this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: gridaphobe Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.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 simonpj): * owner: => gridaphobe -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: gridaphobe Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.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 simonpj): Test T11549 demonstrates this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11787: Infer HasCallStack where possible
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: gridaphobe
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.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 Simon Peyton Jones

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: gridaphobe Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.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): Rewriting the IP to use the built-in synonym was originally part of Phab:D1912 (finally merged this morning!), but I believe I removed it in the last revision since we no longer infer CallStacks, period. So as of this morning your example should look like {{{ Prelude> :t error error :: GHC.Stack.Types.HasCallStack => [Char] -> a Prelude> :t (\x -> error x) (\x -> error x) :: [Char] -> a }}} I don't quite see the connection between #11376 and this issue. You seem to be suggesting that the fix for #11376 involves expanding type synonyms, which sounds like a very undesirable side-effect to me! Does this mean `:type` would also expand a synonym for a giant monad stack? Regardless, if we need to rewrite the type to use the synonym that should be easy to do. If I'm lucky it's even still in my git history somewhere :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: gridaphobe Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: invalid | 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 simonpj): * status: new => closed * resolution: => invalid Comment:
we no longer infer CallStacks, period
Oh yes, right! That makes this ticket redundant.
You seem to be suggesting that the fix for #11376 involves expanding type synonyms,
Typechecking any expression, such as `(\x -> error x)` involves instantiating constraints, in this case the `HasCallStack` constraint from `error`. Then we simplify and re-generalise. It's that step that expands the synonym. Anyway, I'll close this as no-longer-relevant. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11787: Infer HasCallStack where possible -------------------------------------+------------------------------------- Reporter: simonpj | Owner: gridaphobe Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: invalid | 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 saurabhnanda): * cc: saurabhnanda (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11787#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC