Hmm, Hugs gives me this:

        (.) . (.) . (.) :: (a -> b) -> (c -> d -> e -> a) -> c -> d -> e -> b

which I think is correct, if still not transparent in its meaning. (ghci gives me a slightly re-named and explicitly quantified variation).

Basically, the idea is that this sort of expression, with n occurrences of *parenthesized* dots (and n-1 unparenthesized ones interspersed) is the "compose a 1-argument function with an n-argument function" variant of the composition operator (in the "obvious" way). For small n, this allows one to get around the limitations of (.) for some points-free applications: for large n, it probably isn't worth it. (Appropriate definitions of "small" and "large" tend to vary :) ).

  --  Fritz

Example nicked from the file I attached to the last message:

        (.<) = (.) . (.)

        stutter = concat .< replicate

Here the use of the "<" symbol is onomatopoeic (or the graphical homologue of that): the two "arms" of the symbol, branching out to the right, suggest that this variant of the composition operator, (.<), takes a 2-argument function on the right.

On Feb 11, 2005, at 12:00 AM, Ketil Malde wrote:

...  Type signatures help, of course.  E.g. with
the previously mentioned and rather cryptic function

        (.) . (.) .(.)

I entered it into GHCi, and got

        :: forall a a b c a.
              (b -> c) -> (a -> a -> a -> b) -> a -> a -> a -> c

and it suddenly is much clearer what it does.

-kzm
--
If I haven't seen further, it is by standing in the footprints of giants

_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to