Skip to content

Pattern variables bound by PatternGuards are not accessible in where clause

Consider:

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.

Trac metadata
Trac field Value
Version 7.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information