Passing functions to other functions is only half the power of first class functions.
Functions may also act as factories, and produce new functions as their results. The
ability to create functions with arbitrary capabilities within the program machinery can
be quite powerful. For example, one might computationally produce a new comparison
function that, in turn, was passed to the qsortF function in the previous panel.
Often, a means of creating a function is with lambda notation. Many languages with
functional features use the word "lambda" as the name of the operator, but Haskell uses
the backslash character (because it looks somewhat similar to the Greek letter, lambda).
A lambda notation looks much like a type signature. The arrow indicates that a lambda
notation describes a function from one type of thing (the thing following the backslash)
to another type of thing (whatever follows the arrow).
The example factory mkFunc packs a fair amount into a short description. The main
thing to notice is that the lambda indicates a function from n to the result. By the type
signature, everything is an Int, although type inference would allow a broader type.
The form of the function definition is primitive recursive. An empty list produces a
result of zero. A non-empty list produces either the result given by its head pair, or the
result that would be produced if only its tail is considered (and the tail eventually
shrinks to empty by recursion).