<div dir="ltr">[Note, total newbie to mailing lists in general, and beginner in haskell as one might have surmised ^^ hopefully I'm doing the right thing here with this mail...]<br><div><br>All, or virtually all
 in the title, but I'll develop. I wrote some useful function (which i 
rather awkwardly called "point2", for "(.) operator applied at the level
 of the second argument of the first function"). Here is its def:<br><br><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style="color:rgb(0,0,0)">point2 </span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> b </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">d </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> b</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">((</span><span style="color:rgb(0,0,0)"> a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> d </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c </span><span style="color:rgb(102,102,0)">))</span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> the </span><span style="color:rgb(0,0,136)">double</span><span style="color:rgb(0,0,0)"> parentheses, totally optional and syntactically pointless, are just there to imply that the </span><span style="color:rgb(0,0,136)">function</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,136)">is</span><span style="color:rgb(0,0,0)"> seen by we users </span><span style="color:rgb(0,0,136)">as</span><span style="color:rgb(0,0,0)"> 'outputting' another </span><span style="color:rgb(0,0,136)">function</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> even though said outputted </span><span style="color:rgb(0,0,136)">function</span><span style="color:rgb(0,0,0)"> can be applied right away</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> of course, outputting then possibly c, or (d -> c) if partial application.<br>-- I named the variables in the pattern like their respective types, for 'clarity'<br></span><code><span style="color:rgb(0,0,0)">point2</span><span style="color:rgb(0,0,0)"></span></code><span style="color:rgb(0,0,0)"> f g a d </span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,0)"> f a </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">g d</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> i originally wrote it </span><span style="color:rgb(0,0,136)">in</span><span style="color:rgb(0,0,0)"> point free style </span><span style="color:rgb(0,0,136)">using</span><span style="color:rgb(0,0,0)"> flip, from Data.Function </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">well</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,136)">my</span><span style="color:rgb(0,0,0)"> own rebuilt wheel actually</span><span style="color:rgb(102,102,0)">);</span><span style="color:rgb(0,0,0)"> so</span><span style="color:rgb(102,102,0)">,</span><span style="color:rgb(0,0,0)"> alternate definition using</span><span style="color:rgb(102,102,0)"> flip == (\f y x -> f x y)</span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(0,0,0)"><code><span style="color:rgb(0,0,0)">point2</span><span style="color:rgb(0,0,0)"></span></code> f g </span><span style="color:rgb(102,102,0)">=</span><span style="color:rgb(0,0,0)"> flip </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">flip f </span><span style="color:rgb(102,102,0)">.</span><span style="color:rgb(0,0,0)"> g</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> proof by decomposition</span><span style="color:rgb(102,102,0)">: (or is it "composition", as we don't actually decompose?)</span><span style="color:rgb(0,0,0)"><br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> f </span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)"> a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> b </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c<br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> flip f </span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)"> b </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c<br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> flip f </span><span style="color:rgb(102,102,0)">.</span><span style="color:rgb(0,0,0)"> g </span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)"> d </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c<br></span><span style="color:rgb(102,102,0)">--</span><span style="color:rgb(0,0,0)"> flip </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">flip f </span><span style="color:rgb(102,102,0)">.</span><span style="color:rgb(0,0,0)"> g</span><span style="color:rgb(102,102,0)">) == f `point2` g</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">::</span><span style="color:rgb(0,0,0)"> a </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> d </span><span style="color:rgb(102,102,0)">-></span><span style="color:rgb(0,0,0)"> c<br></span></div></code></div><br>anyways,
 it's pretty useful if you wanna combine f and g but g is meant to 
output the *second* argument of f, not the first, that is: <div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">f a</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">.</span><span style="color:rgb(0,0,0)"> g </span><span style="color:rgb(102,102,0)">==</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">f </span><span style="color:rgb(0,136,0)">`point2`</span><span style="color:rgb(0,0,0)"> g</span><span style="color:rgb(102,102,0)">)</span><span style="color:rgb(0,0,0)"> a</span></div></code></div>in
 the first expression, "a" must necessarily be known and given to 
combine f and g in point-free style, whereas in the second one, "a" can 
be omitted, hence then we could write "foo = f `point2` g", which is way
 closer to the point-free style, way simpler to understand too in my 
opinion once you got the picture.<br><br>If you got all I said above, my
 question is then to know if this point2 function already exists 
officially, coz I don't really wanna reinvent the wheel, plus I wonder 
how they called it ^^ I'm not really satisfied of "point2" as variable 
name. I'd love (.2) but it's not compatible with Haskell. ^^<br><br>Also, same 
question for the following function (does it already exists?), again a 
sibling of (.), here, the purpose being to write h(a, b) = f (g(a, b))  
in point-free style:<br><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><code><span style="color:rgb(102,0,102)">after2 :: (c -> d) -> (a -> b -> c) -> (( a -> b -> d ))<br>after2 f g a b = f (g a b)<br>-- its name implies an infix use, for example: h = f `after2` g</span></code><span style="color:rgb(102,102,0)"></span></div></code></div>basically,
 if you know about Data.Function(on), it's a bit (one of) its opposite: 
`on` applies g to both arguments of f independently, before giving both 
results to the 2-ary function f, ie<br><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style="color:rgb(102,0,102)">(f `on` g) a b == f (g a) (g b)</span><span style="color:rgb(102,102,0)"></span></div></code></div><br>I'm not entirely sure, but I think we could write:<br><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style="color:rgb(0,0,0)">f `after2` g == curry </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">f </span><span style="color:rgb(102,102,0)">.</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(102,102,0)">(</span><span style="color:rgb(0,0,0)">uncurry g</span><span style="color:rgb(102,102,0)">))</span><span style="color:rgb(0,0,0)"></span><br>-- since:<br>uncurry g :: (a,b) -> c<br>f . uncurry g :: (a,b) -> d<br>curry (f . uncurry g) :: a -> b -> d</div></code></div><br>un/curry functions' defs, if needed:<br><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style="color:rgb(0,0,0)"></span>curry :: ((a,b) -> c) -> a -> b -> c<br></div><div>curry f a b = f (a,b)<br></div><div>-- curry f :: a -> b -> c when f :: (a,b) -> c<br></div><div>uncurry :: (a -> b -> c) -> (a,b) -> c<br></div><div>uncurry g (a,b) = g a b<br></div><div>-- uncurry g :: (a,b) -> c when g :: a -> b -> c<br></div></code></div><code><div><span style="color:rgb(102,102,0)"></span></div></code></div></div>