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

GHC ghc-devs at haskell.org
Mon Sep 30 16:01:34 CEST 2013


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

 This works:

 {{{
 (id -> ()) = ()
 }}}

 This also works:

 {{{
 di :: a -> a
 di = \x -> x
   where
     (di -> ()) = ()
 }}}

 But none of the following work:

   {{{
   (di -> ()) = () -- Not in scope: di

   di :: a -> a
   di = \x -> x
   }}}
   {{{
   di :: a -> a
   di = \x -> x

   (di -> ()) = () -- Not in scope: di
   }}}
   {{{
   (di -> ()) = () -- Not in scope: di
       where
           di :: a -> a
           di = \x -> x
   }}}

 This looks like a bug to me. Is it? And is this in any way related to
 #4061?

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



More information about the ghc-tickets mailing list