[GHC] #12468: GADTs don't refine hole types

GHC ghc-devs at haskell.org
Thu May 18 17:37:06 UTC 2017


#12468: GADTs don't refine hole types
-------------------------------------+-------------------------------------
        Reporter:  benjamin.hodgson  |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11325            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * os:  MacOS X => Unknown/Multiple
 * related:   => #11325


Comment:

 As noted in #11325, this is actually a regression from GHC 7.10 to 8.0. In
 GHC 7.10.3, you get the behavior that you seek:

 {{{
 $ /opt/ghc/7.10.3/bin/ghci Bug.hs
 GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:7:7:
     Found hole ‘_’ with type: Int
     Relevant bindings include f :: T a -> a (bound at Bug.hs:7:1)
     In the expression: _
     In an equation for ‘f’: f I = _
 Failed, modules loaded: none.
 }}}

 As opposed to the current behavior:

 {{{
 $ /opt/ghc/8.0.1/bin/ghci Bug.hs
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:7:7: error:
     • Found hole: _ :: a
       Where: ‘a’ is a rigid type variable bound by
                the type signature for:
                  f :: forall a. T a -> a
                at Bug.hs:6:6
     • In the expression: _
       In an equation for ‘f’: f I = _
     • Relevant bindings include f :: T a -> a (bound at Bug.hs:7:1)
 Failed, modules loaded: none.
 }}}

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


More information about the ghc-tickets mailing list