Reputation: 185
I was wondering if we can use where in an anonymous function or not. I tried to do it in this way:
\x -> k where k = x+1
But this gives a parse error on 'where'.
Upvotes: 0
Views: 1129
Reputation: 48591
You can use where
in certain expressions within a lambda expression, but not just inside.
f = \x ->
case x of
Nothing -> 12
Just y -> z * 2
where z = y + 7
Upvotes: 5