[GHC] #14897: QuantifiedConstraints: Can't print type of quantified constraint

GHC ghc-devs at haskell.org
Mon Apr 2 22:44:31 UTC 2018


#14897: QuantifiedConstraints: Can't print type of quantified constraint
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:  invalid           |             Keywords:
                                     |  QuantifiedConstraints, wipT2893
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:

 What `:t e` does is to infer the type of the expression `e` and print it.

 So with `a :: (forall xx. Monoid (f xx)) => f a`, it's as if you'd typed
 the top level decl
 {{{
 foo = a
 }}}
 What happens?  We instantiate the type of `a` to get a Wanted constraint
 {{{
 [W] forall x. Monoid (f1 x)
 }}}
 and the type `f1 a1`, where `f1` and `a1` are unification variables.  Now
 we try to simplify the constraints and infer the most general type for
 `foo`.  Unsurprisingly, we fail with the reported error message.

 If, rather than inferring the type of an arbitrary ''expression'', you
 want to ask for the type (and other info) about an ''identifier'', use
 `:info a`.

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


More information about the ghc-tickets mailing list