
On 13 Jan 2008, at 5:49 PM, Achim Schneider wrote:
Jonathan Cast
wrote: On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote:
Answer #2:
Because you can't write
f x = case x of [] -> [1] -> sort.nub
But why not?
Because arities aren't lifted to the longest argument list.
I think you lost the point of my question...
Treating case as syntax sugar for a higher-order function, so that all binding occurrences of lambdas in the unsugared code are associated with lambdas, is a good thing, and offers a natural way of desugaring the above, one case at a time.
What about
f x = [1] f - = sort.nub
?
You could also do things like
f - x = (foo x).bar
with it. No more rewriting of pointfree code because of added arguments...
So `-' as a pattern means `implicitly apply the RHS to whatever this pattern matches'? I like it. jcc