11 Operators as Functions

Binary operators are actually functions!

This 1 + 1 is infix notation, it goes between the two parameters. If we wrap it in parenthesis, it becomes a function!

You can do this with any operator, including the equality operator!

Note that it has a type 'a -> 'a -> bool, it's a polymorphic type comparison operator. You can compare any two types as long as they have the same value.

Other operators have the same type! We can also declare our own infix operator!

Let's declare an infix operator for the maximum number. Note that max is built into the language.

Note that when it's written in infix notation, there are no parenthesis.