[GHC] #10954: Add class/context information to typed hole relevant bindings

GHC ghc-devs at haskell.org
Fri Oct 9 16:50:22 UTC 2015


#10954: Add class/context information to typed hole relevant bindings
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.2
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #9479
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHC's typed hole messages don't currently include any known context
 information for relevant bindings. For example:

 {{{#!hs
 bar :: a ~ b => a -> b -> Int
 bar x y = _
 }}}

 gets me

 {{{
     Found hole ‘_’ with type: Int
     Relevant bindings include
       y :: b (bound at <interactive>:8:42)
       x :: a (bound at <interactive>:8:40)
       bar :: a -> b -> Int (bound at <interactive>:8:36)
     In the expression: _
     In an equation for ‘bar’: bar x y = _
 }}}

 The types `a` and `b` are not unified, and the `a ~ b` constraint is not
 shown.

 {{{#!hs
 foo :: Show a => a -> Int
 foo x = _
 }}}

 gets me

 {{{
     Found hole ‘_’ with type: Int
     Relevant bindings include
       x :: a (bound at <interactive>:4:36)
       foo :: a -> Int (bound at <interactive>:4:32)
     In the expression: _
     In an equation for ‘foo’: foo x = _
 }}}

 The `Show` constraint is lost.

 === What I want ===

 I'd like context information for all type variables in known bindings, so
 I can see all the pieces available to help me fill in the hole.

 === Related ticket ===

 In #9479, Dominique Devriese wants to see any constraints ''on'' an
 ambiguously-typed hole.

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


More information about the ghc-tickets mailing list