
On Feb 14, 2005, at 2:07 AM, Daniel Fischer wrote:
A question for the point-free society: Is there any advantage of defining
(.<) = (.) . (.)
rather than
f .< g = \x y -> f (g x y) -- or f $ g x y ?
Analogous question for (.) . (.) . (.) etc.
Well, from the fact that you even pose the question, and notwithstanding wise remarks from Simon Marlow, I'm guessing that "out of sheer impish delight" or "to tickle the aesthetic sense the way a bump to the elbow tickles the funny bone" are not the sort of answers you're looking for :) . (Note that others have since risen to the occasion in this vein. And remember that all these "dotted dots" were Jerzy's fault, not mine, and that beer was at hand ... .) More seriously, however, the generalization to n raises some interesting issues. For surely we are tempted to something like this, in a half-imagined syntax (read the LHS as "dot sub n"): (. _ n) = foldl1 (.) (replicate n (.)) And, just as surely, we shouldn't be satisfied with the answer "Hindley-Milner don't do dat" * . Rather, we should seek out ways to extend the type system and the language so that we could make this abstraction, and others like it, which are compelling at some basic level. The point being, this generalization might not occur to us (and drive us to new heights, etc.) if we didn't express it in the more "precious" style. -- Fritz PS: Which is not to say that the Haskell type system can't be wrenched (coerced, cajoled, gently plied with sweet whispers ...) into doing things *similar* to this, using type-level natural numbers, or perhaps existentially-quantified data constructors. I'm sure that "extreme typists" like Oleg and Ken do this sort of thing to warm up in the morning, the way other typists (the mundane sort) lace their fingers together and stretch them out before settling in to their 60-words-per-minute day. But perhaps someone else should post some code along these lines, lest Oleg and Ken despair too much of having wasted their efforts on us. I promise to try out a few ideas myself when I get the chance. * (take no offense: just a reference to the old "In Living Color" variety show)