Re[Haskell-cafe] commending "Design concepts in programming languages"

Daniel Fischer daniel.is.fischer at web.de
Thu May 7 08:42:50 EDT 2009


Am Donnerstag 07 Mai 2009 10:23:41 schrieb j.waldmann:
> * in the Appendix on notation,  he defines composition of functions
> the "wrong way around" (i.e., the Haskell way, (f.g)(x) = f(g(x)).
> This is of course very awkward, especially considering that functions are
> relations,
> and an element of a relation is a directed edge, and there's a very obvious
> meaning
> of how edges are composed to give a path.
> Well, the book's "solution" is to avoid to define composition of relations!
> (p. 1155, they only define the n-fold composition of a relation with
> itself, and there the problem does not show.)
>
> PS: I was shocked to find recently that Bourbaki (!) also defines
> functional composition "wrongly"
> (at least in the English edition of Elements of Math./Theory of Sets,
> II.3.7)
> but at least they are consistent and define composition of relations
> ("graphs") accordingly.
> They are very honest about this, e.g. "Let G1, G2, G3 be graphs.
> Then (G3 * G2) * G1 = G3 * (G2 * G1)."  (note the order of the variables)

That's the way composition of functions (and more generally relations) has been done for 
ages in mathematics. And since one writes f(x) and not x.f, it's the consistent way to 
define the composition.
Of course, if centuries ago people had decided to write the argument before the function, 
composition would've been defined the other way round.
They haven't.


More information about the Haskell-Cafe mailing list