-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flip const #69
Comments
AFAIK, of all the possibilities in your post, only |
I guess I don't see what makes that special. But certainly have no confidence that it isn't. |
Looks like your 4th line has a typo: it should be |
I don't see why the 3rd line is a problem, but the 4th line isn't. The 4th line uses an inlined version of flip, so I don't see why it isn't equivalent. |
After a beta-reduction, |
So both definitions of f have a problem? That I understand, but wasn't my understanding of your statement. |
Hmm, or maybe I have come back to this thread after too long away. I'll have a reread in the morning when I'm more fresh. |
I realize I was a bit unclear. These are fine:
And these are bad:
|
Cool, I follow now. Given it's so easy to get this wrong, I'm thinking a function that is morally |
Sometimes you want the function which takes two arguments and ignores the first. You can write that as:
Assuming that thing is called
f
, and we pass around a WHNFf x
, the first two of those will leave thex
captured. But in my view, the first two are also clearer to read. I however, don't guarantee that's true, my reasoning may be wrong....It seems like having a
flipConst
or other function might be useful, with the best space behaviour it can do? Or maybe the restriction to only after people seq a function is just not helpful? Is there a good name for this function? Do lambdas really reduce differently for\x y -> ...
vs\x -> \y -> ...
? Or does theid
make it different?CC @josephcsible who brought this up first in HLint.
The text was updated successfully, but these errors were encountered: