Open stuartpb opened 7 years ago
flip' x y = y x
is not equivalent to flip f x y = f y x
. Note that id x = x
and id' x y = x y
are equivalent, which explains that flip id' x y = id' y x = y x = flip' x y
.
Right, I'd forgotten about the f
that flip
takes, and flip' f x y = f y x
does indeed reduce to flip' = flip
.
Is there no shorter name for reverse-function-application than flip id
, then? I'd heard some rumbling about &
on Reddit (I seem to remember finding some documentation saying its purpose was to allow nesting in $
clauses), but I can't find any documentation on it at the moment. (No results on Hoogle, and that's the problem with single-punctuation-character function names: they're impossible to Google.)
Yes, you could say that flip' = &
, but that operator is only available in the newest GHC, so not sure if the maintainer wants to use it in pointfree already. You can find it on the beta version of hoogle: http://hoogle.haskell.org/?hoogle=%26&scope=set%3Astackage
I think it's fine to use &
at this stage, but I don't think I'll get round to spending time on it personally :)
Passing
flip' x y = y x
on pointfree.io returnsflip' = flip id
instead of justflip' = flip
, which would be equivalent, and neater.