[GHC] #12188: Pattern variables bound by PatternGuards are not accessible in where clause
GHC
ghc-devs at haskell.org
Mon Jun 13 18:14:00 UTC 2016
#12188: Pattern variables bound by PatternGuards are not accessible in where clause
-------------------------------------+-------------------------------------
Reporter: heisenbug | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: invalid | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by heisenbug):
Replying to [comment:2 goldfire]:
> Right now, GHC works the other way, accepting this:
>
> {{{#!hs
> foo :: Int -> Int
> foo x
> | should_add = x + 1
> | otherwise = x - 1
> where
> should_add = x > 0
> }}}
>
> I've not checked to see whether this is specified in the Report, but my
guess is that it is.
>
> I'm closing as invalid, but do reopen if I've misunderstood.
I am not sure whether we are on the same page. In your example
`should_add` is a boolean guard, it does not establish a new binding.
In my example `b` is a pattern variable bound by the pattern guard. Your
example does not contain such a thing. Your `should_add` use is morally
equivalent to my `return` (and `a`) use.
Do you still think this ticket is invalid?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12188#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list