
G'day all.
Quoting Neil Mitchell
I don't believe that. I suspect the type system will mop these up.
As previously noted, anything involving undefined (thanks to seq) is not equivalent. While undefined is arguably uncommon, error most certainly isn't: f1 (x:xs) = {- something -} f1 [] = error "empty list" -- add an argument, to get... f2 (x:xs) y = {- something -} f2 [] = error "empty list" f2 is type-correct, but is subtly different from f1, both semantically and (I think) performance-wise. On sharing: It's not generally appreciated, but in GHC, there's a subtle difference between: g x y = let z = p x in q x y z and: g x = \y -> let z = p x in q x y z the difference being that in the latter, the definition of z can be let-floated: g x = let z = p x in \y -> q x y z GHC does not float lets over lambdas if it would "break" a group of function arguments. Any proposed desugaring would have to either come up with a better rule than this, or find a way to preserve it. Cheers, Andrew Bromage