Introduction
Haskell is built on functions, and all functions in Haskell can be represented using lambda expressions.
You might remember functions from algebra, like
where is the name of a function that takes in the variable and outputs the value . is the name, is the input, and is the output.
The important thing that makes a function is that if you put the same value in it, you always get the same result. One input cannot give you two different outputs. In other words, a function tells you how to take its input and map it to an output. This is an important concept in functional programming.
In the lambda calculus, this function becomes
which is an abstraction where the part to the left of the dot is the head and the part to the right of the dot is the body. The head has a lambda and an input variable (the argument), while the body has an expression. If a variable in the body's expression appears in the head, it is bound to the head and will take the value of the input argument.
Unlike the named function , the lambda abstraction doesn't have a name—it's an anonymous function.
I'm working through a Haskell textbook and posting my notes. Check it out from time to time, and please do offer suggestions, corrections, or additions if you have any.
