[Haskell-cafe] Re: Re: nested maybes

Benjamin Franksen benjamin.franksen at bessy.de
Tue Feb 6 19:13:55 EST 2007

Udo Stenzel wrote:
> Benjamin Franksen wrote:
>> Udo Stenzel wrote:
>> > Sure, you're right, everything flowing in the same direction is usually
>> > nicer, and in central Europe, that order is from the left to the right.
>> > What a shame that the Haskell gods chose to give the arguments to (.)
>> > and ($) the wrong order!
>> But then application is in the wrong order, too. Do you really want to
>> write (x f) for f applied to x?
> No, doesn't follow.

No? Your words: "everything flowing in the same direction".

Of the two definitions

(f . g) x = g (f x)


(f . g) x = f (g x)

the first one (your prefered one) turns the natural applicative order
around, while the second one preserves it. Note this is an objective
argument and has nothing to do with how I feel about it.

> Unix pipes also read from left to right, even  
> though programs receive their arguments to the right of the program
> namen, and that feels totally natural.

I'd say what 'feels natural' is in the eye of the beholder. One can get used
to almost any form of convention, notational and otherwise, however
inconsistent. For instance, the Haskell convention for (.) feels natural
for me, because I have been doing math for a long time and mathematicians
use the same convention. OTOH, the math convention also says that the type
of a function is written (ArgType -> ResultType), although (ResultType <-
ArgType) would have been more logical because consistent with the
application order. I am used to it, so it feels natural to me, but does
that make it the better choice?


More information about the Haskell-Cafe mailing list