[GHC] #10614: Show constraints in ``Found hole...''

GHC ghc-devs at haskell.org
Wed Nov 16 12:03:19 UTC 2016


#10614: Show constraints in ``Found hole...''
-------------------------------------+-------------------------------------
        Reporter:  bjmprice          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.1
      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 zyla):

 +1 for class constraints. This comes up a lot when working with
 existentials. Consider this (contrived) example:


 {{{#!hs
 {-# LANGUAGE GADTs #-}

 data AnyShow where
   AnyShow :: Show a => a -> AnyShow

 foo :: AnyShow -> String
 foo (AnyShow x) = _
 }}}

 GHC currently (8.1.20161115) gives the following message:

 {{{

 foo.hs:6:19: error:
     • Found hole: _ :: p
       Where: ‘p’ is a rigid type variable bound by
                the inferred type of foo :: AnyShow -> p at foo.hs:6:1-19
     • In the expression: _
       In an equation for ‘foo’: foo (AnyShow x) = _
     • Relevant bindings include
         x :: a (bound at foo.hs:6:14)
         foo :: AnyShow -> p (bound at foo.hs:6:1)
 }}}

 The situation is even worse here than in OP's example, since `a` appears
 out of nowhere, and `Show a` isn't mentioned.

 But I think the decision whether to include them isn't that hard - we
 could have both `-fprint-equality-constraints` and `-fprint-class-
 constraints`.

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


More information about the ghc-tickets mailing list