You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Haskell, a function can be called in an infix position, such as arg1 func arg2, by surrounding the function name with backticks. I'm not a big fan of Haskell's particular syntax for infix notation, but support for some means of providing infix notation would be nice.
Current ideas:
{arg1 func arg2}, in which all three elements are <single>s. The downside is that an expression like {fib {n - 1} + fib {n - 2}} would be unparsable. {(fib {n - 1}) + (fib {n - 2})} would be fine, though, so it's probably fine, and extreme cases could just stick the arguments in variables first to make it cleaner.
arg1 {func} arg2, in which all three elements are arbitrary expressions. This seems a bit more awkward to parse and is depressingly similar to the Haskell notation.
The text was updated successfully, but these errors were encountered:
After attempting to implement the first variant ({arg1 func arg2}), I have discovered a problem that affects both. The usage of { at the beginning of an expression introduces an ambiguity with switches, as switches start with switch <expr> {. This isn't an issue if the function at the beginning of <expr> is the infix expression, but if an argument is, such as in switch f {1 + 2} {, then the parser can't tell that the first { isn't the beginning of the switches cases.
The only solutions I can think of are either to use a completely different infix notation, or to change the <switch> syntax. I'm leaning towards the former, but I'm not quite sure what to use.
In Haskell, a function can be called in an infix position, such as
arg1 func arg2
, by surrounding the function name with backticks. I'm not a big fan of Haskell's particular syntax for infix notation, but support for some means of providing infix notation would be nice.Current ideas:
{arg1 func arg2}
, in which all three elements are<single>
s. The downside is that an expression like{fib {n - 1} + fib {n - 2}}
would be unparsable.{(fib {n - 1}) + (fib {n - 2})}
would be fine, though, so it's probably fine, and extreme cases could just stick the arguments in variables first to make it cleaner.arg1 {func} arg2
, in which all three elements are arbitrary expressions. This seems a bit more awkward to parse and is depressingly similar to the Haskell notation.The text was updated successfully, but these errors were encountered: