[GHC] #16146: Trivial partial type signature kills type inference in the presence of GADTs

GHC ghc-devs at haskell.org
Thu Jan 10 09:06:51 UTC 2019


#16146: Trivial partial type signature kills type inference in the presence of
GADTs
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.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):

 '''Let-must-not-be-generalised''' behaviour

 > Because GHC does not respect let-should-not-be-generalized in the
 presence of partial type signatures, this is rejected again.

 It's hard to see how GHC ''could'' respect let-should-not-be-generalised.
 Consider
 {{{
 f :: forall a. _ -> a
 f = e
 }}}
 How could we check this signature without generalising the type of `e`?  I
 suppose there could be a special case if there is no user-written
 `forall`.  So `f :: forall. blah` means "please generalise` and `f ::
 blah` means "don't generalise".  But that's in conflict with some of the
 choices under "forall-or-nothing" above.

 Regardless, it'd be good to document the behaviour in the manual.

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


More information about the ghc-tickets mailing list