Can someone explain to me with simple words what those two operators do:
$
\
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
\is not an operator, it is part of the literal syntax. More precisely, it is part of two literal syntaxes: it denotes a lambda literal and it serves as an escape character in string literals.The operator
$is defined in the prelude asIn other words, it does exactly the same thing as whitespace does, namely just plain function application. However, while function application is left-associative and has high precedence (the highest, in fact),
$is right-associative and has low precedence.This allows you to omit parentheses when you have chains like “
fapplied togapplied tohapplied tox“, which without the$operator would be written likebut with the operator can be written as
It is also useful if you want to pass the function application operator itself as an argument to another function. Say, you have list of functions and a list of values and you want to apply every function in the list to the corresponding value in the other list: