Skip to content

View patterns + pattern bindings: finnicky about scoping

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 (closed)?

Trac metadata
Trac field Value
Version 7.6.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