[Haskell-cafe] Function application like a Unix pipe
Bill Wood
william.wood3 at comcast.net
Wed Nov 23 14:28:00 EST 2005
On Wed, 2005-11-23 at 08:55 -0800, Scherrer, Chad wrote:
. . .
> I see. I like the argument order also, since it so nicely reflects
> mathematical notation. But I do think there's a place for (flip ($)) and
> (flip (.)). The problem is that the assignment of fixities is much more
> subtle and requires a consideration of what should be considered "proper
> style".
Interesting note: in Richard Bird and Oege de Moor, _Algebra of
Programming_, pp. 2-3, the authors write
As a departure from tradition, we write "f : A <- B" rather than
"f : B -> A" to indicate the source and target types associated
with a function "f". ... The reason for this choice has to do with
functional composition, whose definition now takes the smooth
form: if f : A <- B and g : B <- C, then f . g : A <- C is defined
by (f . g) x = f(g x).
Further along the same paragraph they write:
In the alternative, so-called diagrammatic forms, one writes
"x f" for application and "f ; g" for composition, where
x (f ; g) = (x f) g.
I know I've read about the latter notation as one used by some
algebraists, but I can't put my hands on a source right now.
I guess it's not even entirely clear what constitutes "mathematical
notation". :-)
-- Bill Wood
More information about the Haskell-Cafe
mailing list