[GHC] #8387: View patterns + pattern bindings: finnicky about scoping

GHC ghc-devs at haskell.org
Mon Sep 30 19:10:16 CEST 2013


#8387: View patterns + pattern bindings: finnicky about scoping
----------------------------------------------+----------------------------
        Reporter:  tinctorius                 |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler                   |          Version:  7.6.3
      Resolution:                             |         Keywords:
Operating System:  Unknown/Multiple           |     Architecture:
 Type of failure:  GHC rejects valid program  |  Unknown/Multiple
       Test Case:                             |       Difficulty:  Unknown
        Blocking:                             |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------

Comment (by rwbarton):

 It is related to #4061, and I think that GHC is correctly implementing the
 scoping rule in the user's guide:

 > In mutually recursive bindings, such as let, where, or the top level,
 view patterns in one declaration may not mention variables bound by other
 declarations. That is, each declaration must be self-contained.

 That doesn't mean the rule is written in stone. I wonder whether it could
 be:

 > In mutually recursive bindings ... view patterns in one declaration may
 not mention variables bound by other ''view patterns''.

 ----

 As a workaround, you can use the Template Haskell hack I just posted on
 #4061 to get your second example to compile.

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



More information about the ghc-tickets mailing list