Reputation: 407
I am learning Elm and after I did the tutorial I am starting e new application from scratch, but when I add a new HTML tag in my view I get an error.
My code:
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
main : Html a
main =
span [ class "welcome-message" ] [ text "Hello, World!" ]
, h1 [class "headline"] [text "Hello"]
Error:
Detected errors in 1 module.
-- SYNTAX PROBLEM -----------------------------------------------------
Main.elm I ran into something unexpected when parsing your code!
10| , h1 [class "headline"] [text "Hello"]
^ I am looking for one of the following things:
end of input
whitespace
I am using Visual Studio Code on Windows 10.
My editor is configured to use LF and 4 spaces indentation.
I am using elm-reactor on PowerShell.
Upvotes: 1
Views: 161
Reputation: 222080
Your code is invalid Elm code: a comma can only go between elements of a list (or record). Also, you can't have two Html nodes at the top level, so you'll need to wrap them in a single element. In this case, you'll probably want to wrap the two in a div [] []
:
main : Html a
main =
div []
[ span [ class "welcome-message" ] [ text "Hello, World!" ]
, h1 [ class "headline" ] [ text "Hello" ]
]
Upvotes: 4