[GHC] #12188: Pattern variables bound by PatternGuards are not accessible in where clause

GHC ghc-devs at haskell.org
Mon Jun 13 11:10:15 UTC 2016


#12188: Pattern variables bound by PatternGuards are not accessible in where clause
-------------------------------------+-------------------------------------
           Reporter:  heisenbug      |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider:
 {{{#!hs
 foo :: Int -> Bool
 foo a | Just b <- return a = c
   where c = a == b
 }}}

 I get:
 {{{
 test.hs:3:18: Not in scope:  b
 }}}

 Is there any reason why pattern variables originating from pattern guards
 should not work in `where` clauses?
 Problem is present in GHC HEAD too.

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


More information about the ghc-tickets mailing list