GHC gives me a parse error on input \~ if I try to put a tilde on the pattern of a lambda expression like I can do with named functions
let step = \~(x,s) -> run (f x) s -- Parse Error
let step ~(x, s) = run (f x) s -- Works fine
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.
You have to add a space between the lambda and the tilde
The source of the confusion is because
\and~are both valid characters for user defined operators so\~is parsed as one instead of being parsed as the start of a lambda expression: