
#15659: Wacky error message when RULE mentions out-of-scope variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Keywords: newcomer | 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: -------------------------------------+------------------------------------- If I compile the following program with GHC 8.4 or later: {{{#!hs module Foo where {-# RULES "test" forall x. f x = x #-} }}} The error message I get is somewhat eyebrow-raising: {{{ $ /opt/ghc/8.4.3/bin/ghc Foo.hs [1 of 1] Compiling Foo ( Foo.hs, Foo.o ) Foo.hs:3:11: error: Rule "test": Not in scope: OutOfScope(f) in left-hand side: f x LHS must be of form (f e1 .. en) where f is not forall'd | 3 | {-# RULES "test" forall x. f x = x #-} | ^^^^^^^^^^^^^^^^^^^^^^^^ }}} I'm not sure what this `OutOfScope` business is, but I doubt we want to be referring to it in error messages. The error in GHC 8.2 and earlier was much less confusing: {{{ $ /opt/ghc/8.2.2/bin/ghc Foo.hs [1 of 1] Compiling Foo ( Foo.hs, Foo.o ) Foo.hs:3:11: error: Rule "test": Not in scope: f in left-hand side: f x LHS must be of form (f e1 .. en) where f is not forall'd | 3 | {-# RULES "test" forall x. f x = x #-} | ^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15659 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler