[GHC] #14293: View patterns with locally defined functions in restructuring don't compile

GHC ghc-devs at haskell.org
Wed Sep 27 17:34:46 UTC 2017


#14293: View patterns with locally defined functions in restructuring don't compile
-------------------------------------+-------------------------------------
           Reporter:  heisenbug      |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           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:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE ViewPatterns #-}

 foo x = x

 Just (id -> res) = pure 'a'   -- WORKS
 Just (foo -> res') = pure 'a' -- FAILS
 bar (foo -> res) = res        -- WORKS


 {-

 [1 of 1] Compiling Main             ( T14293.hs, interpreted )

 T14293.hs:6:7-9: error: Variable not in scope: foo :: Char -> t
   |
 6 | Just (foo -> res') = pure 'a'
   |       ^^^
 Failed, 0 modules loaded.

 -}
 }}}

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


More information about the ghc-tickets mailing list