I’m working my way through the book Elm in Action, and have found myself stuck on one of the code revisions.
While the update at [https://livebook.manning.com/book/elm-in-action/chapter-4/42](https://livebook.manning.com/book/elm-in-action/chapter-4/42)
contains intentional errors from the author (which get corrected later in the lesson), I’m getting an unexpected error when I try to save the file.
My code:
1 module PhotoGroove exposing (main)
2
3 import Array exposing (Array)
4 import Browser
5 import Html exposing (..)
6 import Html.Attributes exposing (..)
7 import Html.Events exposing (onClick)
8 import Random
9
10
11 urlPrefix : String
12 urlPrefix =
13 "http://elm-in-action.com/"
14
15
16 type Msg
17 = ClickedPhoto String
18 | GotSelectedIndex Int
19 | ClickedSize ThumbnailSize
20 | ClickedSurpriseMe
21
22
23 view : Model -> Html Msg
24 view model =
25 div [ class "content" ]
26 (case model.status of
27 Loaded photos selectedUrl ->
28 viewLoaded photos selectedUrl model.chosenSize
29
30 Loading ->
31 []
32
33 Errored errorMessage ->
34 [ text ("Error: " ++ errorMessage) ]
35 )
36
37 viewLoaded : List Photo -> String -> ThumbnailSize -> List (Html Msg)
38 viewLoaded photos selectedUrl chosenSize =
39 [ h1 [] [ text "Photo Groove" ]
40 , button
41 [ onClick ClickedSurpriseMe ]
42 [ text "Surprise Me!" ]
43 , h3 [] [ text "Thumbnail Size:" ] ...
When saving, the error reads `"Unable to parse file /var/folders/fw/4g835n4x0qnc1v9gj7trpd_c0000gp/T/vQgfPJB/317.elm:
39:7 To see a detailed explanation, run elm make on the file.’
Line 39:7 looks like it refers to the h1 in viewLoaded. To my eye, the code is consistent with that in the book. Would really appreciate any pointers on what I’m missing here!