[GHC] #11573: Inferred CallStacks expose implicit parameter

GHC ghc-devs at haskell.org
Mon Apr 4 11:06:59 UTC 2016


#11573: Inferred CallStacks expose implicit parameter
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  gridaphobe
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11383            |  Differential Rev(s):  Phab:D1911,
       Wiki Page:                    |  Phab:D1912
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8/ghc" 7407a66/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8"
 Don't infer CallStacks

 We originally wanted CallStacks to be opt-in, but dealing with let
 binders complicated things, forcing us to infer CallStacks. It turns
 out that the inference is actually unnecessary though, we can let the
 wanted CallStacks bubble up to the outer context by refusing to
 quantify over them. Eventually they'll be solved from a given CallStack
 or defaulted to the empty CallStack if they reach the top.

 So this patch prevents GHC from quantifying over CallStacks, getting us
 back to the original plan. There's a small ugliness to do with
 PartialTypeSignatures, if the partial theta contains a CallStack
 constraint, we *do* want to quantify over the CallStack; the user asked
 us to!

 Note that this means that

   foo :: _ => CallStack
   foo = getCallStack callStack

 will be an *empty* CallStack, since we won't infer a CallStack for the
 hole in the theta. I think this is the right move though, since we want
 CallStacks to be opt-in. One can always write

   foo :: (HasCallStack, _) => CallStack
   foo = getCallStack callStack

 to get the CallStack and still have GHC infer the rest of the theta.

 Test Plan: ./validate

 Reviewers: goldfire, simonpj, austin, hvr, bgamari

 Reviewed By: simonpj, bgamari

 Subscribers: bitemyapp, thomie

 Projects: #ghc

 Differential Revision: https://phabricator.haskell.org/D1912

 GHC Trac Issues: #11573
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11573#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list