-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operators in $if #13
Comments
No, you can't use an operator like that, that's why it's not $if (>) (length list) 2 On Tue, Mar 15, 2011 at 8:36 PM, scan
|
Is that a general restriction or can that be solved? |
I don't think it's solvable, but more to the point, I don't want to solve it. I think allowing arbitrary infix syntax is a bad direction for Hamlet. I agree 100% that it would be useful in many situations, but it also leads to some ambiguity. For example, the same Hamlet template could have different meanings depending on which modules are in scope when it is called. On the other hand, we could simply force all operators to have the same precedence rules, but then it won't line up with the Haskell code. |
Yes, ok, thanks. It makes sense there, after all, it makes no difference for the program, only to the programmer. |
Another issue I have found, not documented, is using an operator in an $if, like so:
And other examples (with ==) and such... they all produce the error 'Unexpected >' or 'Unexpected =' and so on. Is that intended? If I define a function
It works fine, and operators are just functions, so shouldn't that work?
Addition:
yields the same problem.
The text was updated successfully, but these errors were encountered: