[GHC] #14000: Out of scope errors with type families do not mention scope

GHC ghc-devs at haskell.org
Thu Jul 20 17:44:02 UTC 2017


#14000: Out of scope errors with type families do not mention scope
-------------------------------------+-------------------------------------
        Reporter:  EyalLotem         |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * version:  8.0.1 => 8.0.2


Comment:

 Actually, the `Couldn't match expected type` error was dropped somewhere
 between 8.0.1 and 8.0.2, since in 8.0.1, you get:

 {{{
 $ /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:5:1: error:
     • Couldn't match expected type ‘T a’ with actual type ‘T a0’
       NB: ‘T’ is a type function, and may not be injective
       The type variable ‘a0’ is ambiguous
     • In the ambiguity check for the inferred type for ‘main’
       To defer the ambiguity check to use sites, enable
 AllowAmbiguousTypes
       When checking the inferred type
         main :: forall a. T a

 ../Bug.hs:5:10: error: Variable not in scope: noSuchThing
 }}}

 But in GHC 8.0.2:

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

 ../Bug.hs:5:1: error:
     • Couldn't match expected type ‘T a’ with actual type ‘T a0’
       NB: ‘T’ is a type function, and may not be injective
       The type variable ‘a0’ is ambiguous
     • In the ambiguity check for the inferred type for ‘main’
       To defer the ambiguity check to use sites, enable
 AllowAmbiguousTypes
       When checking the inferred type
         main :: forall a. T a
 }}}

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


More information about the ghc-tickets mailing list