[GHC] #13485: Doesn't warn about variable not in scope

GHC ghc-devs at haskell.org
Sat Mar 25 22:03:09 UTC 2017


#13485: Doesn't warn about variable not in scope
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  worksforme        |             Keywords:  GADTs
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 RyanGlScott):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Erm, GHC //does// give you a `Variable not in scope: (&)` error in GHC
 8.0.1, 8.0.2 and 8.2.

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

 Bug2.hs:29:13: error:
     Variable not in scope: (&) :: FunC a -> t0 -> FunC a -> FunC a

 Bug2.hs:29:23: error:
     • Couldn't match type ‘Internal t0’ with ‘a0 -> a0 -> a0’
       Expected type: FunC (Internal t0)
         Actual type: FunC (a0 -> a0 -> a0)
       The type variables ‘t0’, ‘a0’ are ambiguous
     • In the first argument of ‘fromFunC’, namely ‘Add’
       In the second argument of ‘(&)’, namely ‘fromFunC Add’
       In the expression: (&) a fromFunC Add
 }}}

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

 Bug2.hs:29:13: error:
     Variable not in scope: (&) :: FunC a -> t0 -> FunC a -> FunC a
    |
 29 | add a b = a &fromFunC Add$ b
    |             ^

 Bug2.hs:29:23: error:
     • Couldn't match type ‘Internal t0’ with ‘a0 -> a0 -> a0’
       Expected type: FunC (Internal t0)
         Actual type: FunC (a0 -> a0 -> a0)
       The type variables ‘t0’, ‘a0’ are ambiguous
     • In the first argument of ‘fromFunC’, namely ‘Add’
       In the second argument of ‘(&)’, namely ‘fromFunC Add’
       In the expression: (&) a fromFunC Add
    |
 29 | add a b = a &fromFunC Add$ b
    |                       ^^^
 }}}

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


More information about the ghc-tickets mailing list