Opened 6 months ago
Pattern guards in anonymous functions
|Reported by:||mcollis||Owned by:|
|Type of failure:||None/Unknown||Difficulty:||Unknown|
|Test Case:||Blocked By:|
In the course of a project, I had an idea that would allow less cumbersome use of cases in anonymous functions. Here's a simple example of what I'm proposing:
(\x y | x > y -> x | otherwise -> something else)
Currently, the only way to accomplish this is with if() then ... else syntax or the use of the MultiWayIf? and LambdaCase? extensions. The syntax I've proposed here matches with existing anonymous function syntax and doesn't conflict with any other GHC syntax. This would greatly improve the readability of complex anonymous functions.