Search code examples
haskellbinary-operators

What are binary operators in haskell


So I wanted to understand the functions foldl and foldr in Hoogle they say that these functions apply to binary operators. But I don't get what these binary operators are. I know that (+) and (-) are binary operators but what defines them ?


Solution

  • Usually mathematicians define a binary operator is a function that takes two arguments. In some papers it is a requirement that the arguments and the result are defined over the same set.

    The fact that the function ? takes two arguments results in the fact that mathematicians frequently use infix notation (like x ? y). For instance (+), (*), etc. are clearly binary operators.