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
Quick Summary: Miss-formatting of an infix subtraction can lead to an interesting phenomena, where the first operand is interpreted as a function and the second as an argument, leading to the compiler saying that a number doesn't take that many arguments. Doing the same with + works fine though.
My assumption is that - is treated as unary operator, something that the + operator apparently doesn't support.
SSCCE
moduleMainexposing (..)
importBrowserimportHtmlexposing (Html, div, text)
-- MAINmain =Browser.sandbox { init = init, update = update, view = view }-- UPDATEupdate:()->Model->Modelupdate _ model =
model
-- MODELtype alias Model=()init:Modelinit =()-- VIEWview:Model->Html()view model =
div [][text (String.fromInt(1-1))]-- div [] [text (String.fromInt(1 - 1))]-- div [] [text (String.fromInt(1 +1))]-- Example illustrating the interpretation of the compiler (at least for me)-- div [] [text (String.fromInt(1 -1 * 2))]
TOO MANY ARGS
Jump to problem
This value is not a function, but it was given 1 argument.
24| div [] [text (String.fromInt(1 -1))]
^
Are there any missing commas? Or missing parentheses?
The text was updated successfully, but these errors were encountered:
I was thinking about adopting ELM for a project but the fact that basic issues like this one are not likely to be solved any time soon leads me to look for an alternative.
Quick Summary: Miss-formatting of an infix subtraction can lead to an interesting phenomena, where the first operand is interpreted as a function and the second as an argument, leading to the compiler saying that a number doesn't take that many arguments. Doing the same with + works fine though.
My assumption is that - is treated as unary operator, something that the + operator apparently doesn't support.
SSCCE
Additional Details
Compiler output:
The text was updated successfully, but these errors were encountered: