14
votes

In Haskell, we use the term "section" to indicate a partially applied function used in infix position. For instance, for a function foo :: a -> b -> c and values x :: a and y :: b, we have the two sections

s1 = (x `foo`) :: b -> c == \b -> foo x b

and

s2 = (`foo` y) :: a -> c == \a -> foo a y

In category theory, however, a section g of f is defined as a right inverse of f (so that f . g == id).

I don't see an obvious connection between the two definitions. For instance, s1 is clearly not an inverse of foo, at least not in Hask. I suppose s1 doesn't even have to have an inverse in Hask.

Is the category-theoretical definition the source of the Haskell definition, and if so, how?

2
My guess is that the two are completely unrelated. I interpret "section" as: you take (x+y), chop off one part of it (take a "section"), and consider what remains. - chi
That's so... prosaic, though. - chepner
I don't know, but I will try to find out. - augustss
The Miranda language had sections, and was designed by David Turner. Miranda strongly influenced the design of Haskell. - ja.
From the Miranda Manual, Chapter 9: Acknowledgement: The idea of sections is due to Richard Bird (of Oxford University Programming Research Group) and David Wile (of USC Information Sciences Institute). miranda.org.uk - ja.

2 Answers

25
votes

As has been pointed out in the comments, Haskell got the sections from Miranda (and Orwell). David Turner says he got the idea from Richard Bird and David Wile.

I have just chatted with Richard Bird. He says he doesn't remember where the name came from, but he thinks it was David Wile who coined it. Unfortunately, David Wile died last year, so we will probably never know. But, Richard did admit that he was the one who convinced David Turner and Phil Wadler to add sections in their languages.

Here's the page from Wile's thesis that is the first know mention of "section". http://imgur.com/a/cQDlu

3
votes

Possibly, it comes from "array section" operation, used primarily in Fortran, particularly for column or row extraction. That makes sense, if you consider making lookup table from two-argument function. https://www.phy.ornl.gov/csep/pl/node16.html