Skip to content

Allow ViewPatterns in function definitions to refer to where-bound names

Motivation

You can't refer to where-bound variables in ViewPatterns in the LHS of a function definition. It seems like it would be useful to be able to do so. Example:

f (g -> x) = ...
  where
    g = ...

doesn't work, but

f = \(g -> x) -> ...
  where
    g = ...

does

I'm not sure if any issues arise from allowing this.

Proposal

It would be nice if the first example from above also worked.

Edited by Georgi Lyubenov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information