This is as an illustrative example for how Expression Tutor activities could be used in a Haskell course. The content on this page may not be understandable for someone without significant prior knowledge.
In Haskell, binary operators really are curried functions. That is, a binary operator is not a function with two arguments, but it is a function of one argument that returns a function of one argument that returns a result.
Let's look at
+. Take the following Haskell expression:
Below is a tree representation of the above expression. You can see that functions are values in Haskell: the + is its own node in the tree. It has type Num a => a -> a -> a. This means that given a type that is a , the function has the type . Functions are curried, that is, the function takes an (the first operand) and returns a function. That function takes an (the second operand) and returns an .
Here is a bigger expression that includes functions such as ,, , and . It also includes the conditional .
Below is a tree representation of the above expression. Your task is to annotate each node of the tree with the appropriate type. To do so, select each node and pick one of the suggested types or enter a type for that node.