[Haskell-cafe] Function application like a Unix pipe
Henning Thielemann
lemming at henning-thielemann.de
Wed Nov 23 11:47:03 EST 2005
On Wed, 23 Nov 2005, Scherrer, Chad wrote:
> Henning Thielemann <lemming at henning-thielmann.de> writes:
>
>> Since
>> (a . b) x
>> a $ b x
>> a (b x)
>>
>> are equivalent, do you also want to reverse function and
>> argument in order to match argument order of . and $ ?
>>
>> That is
>> x (b . a)
>> x b $ a
>> (x b) a
>> ?
>
> I'm sorry, I'm not sure I understand your question. Are you asking
> whether one should be allowed to write x f instead of f x? I don't think
> anyone is advocating this, but is can be convenient to have an infix
> operator for this purpose.
I want to say, that the order of symbols for ($), (.) and function
application is consistent. This is a fine thing. I think that shall not be
distroyed by giving ($) and (.) reversed argument order.
It's of course a good question, why (>>) and (>>=) have the opposite
order of (.). Compare function application
a b
where a is applied to b with the monadic case
b >>= a
where a is applied to the result of b. This makes changing a non-monadic
expression to a similar monadic expression more difficult.
Why is there no (<<) and why is (=<<) not the default? The order of 'do
{a;b;c}' is compatible with that of (>>). So we have the fundamental
conflict, that usually function application is from right to left, but
interpreting imperative statements is from left to right.
I think that's a similar conflict like that of little endian and big
endian.
More information about the Haskell-Cafe
mailing list