[GHC] #12220: TypeApplications and DefaultSignatures - problems deducing type variables.

GHC ghc-devs at haskell.org
Fri Jun 24 10:00:33 UTC 2016


#12220: TypeApplications and DefaultSignatures - problems deducing type variables.
-------------------------------------+-------------------------------------
        Reporter:  mkloczko          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  DefaultSignatures, TypeApplications
Operating System:  Linux             |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"d2958bd08a049b61941f078e51809c7e63bc3354/ghc"
 d2958bd0/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="d2958bd08a049b61941f078e51809c7e63bc3354"
 Improve typechecking of instance defaults

 In an instance declaration when you don't specify the code for a
 method, GHC fills in from the default binding in the class.
 The type of the default method can legitmiately be ambiguous ---
 see Note [Default methods in instances] in TcInstDcls --- so
 typechecking it can be tricky.

 Trac #12220 showed that although we were dealing with that ambiguity
 for /vanilla/ default methods, we were not doing so for /generic/
 default methods.  Moreover we were dealing with it clumsily, by
 generating post-typechecked code.

 This patch fixes the bug AND deletes code!  We now use the same code
 path for both vanilla and generic default methods; and generate
 /pre-typechecked/ code in both cases.  The key trick is that we can use
 Visible Type Application to deal with the ambiguity, which wasn't
 possible before.  Hooray.

 There is a small hit to performance in compiler/perf/T1969 which
 consists of nothing BUT instance declarations with several default
 methods to fill, which we now have to typecheck. The actual hit is
 from 724 -> 756 or 4% in that extreme example.  Real world programs
 have vastly fewer instance decls.
 }}}

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


More information about the ghc-tickets mailing list