This is because the syntax for record updates does not allow you to update 
nested records like what you are attempting.

This is part of an ongoing discussion.  There is a thread where you can post 
your specific scenario: 
https://groups.google.com/forum/#!searchin/elm-discuss/record%7Csort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ
 
<https://groups.google.com/forum/#!searchin/elm-discuss/record|sort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ>

Dustin


> On Apr 21, 2017, at 5:33 PM, Dwayne Crooks <[email protected]> wrote:
> 
> Hi,
> 
> I got the following syntax error:
> 
> I ran into something unexpected when parsing your code!
> 62|             { Rating.defaultViewConfig | readOnly = model.readOnly }
>                   ^
> I am looking for one of the following things:
>     a closing bracket '}'
>     a lower case name
>     whitespace
> 
> for the following snippet of code:
> 
> view : Model -> Html Msg
> view model =
>     let
>         ratingViewConfig =
>             { Rating.defaultViewConfig | readOnly = model.readOnly }
>     in
>         div []
>             [ Html.map SetRatingState <|
>                 Rating.view ratingViewConfig model.ratingState
>             , label []
>                 [ input
>                     [ type_ "checkbox"
>                     , checked model.readOnly
>                     , onClick ToggleReadOnly
>                     ]
>                     []
>                 , text "read only"
>                 ]
>             ]
> 
> If however I write the following:
> 
>     let
>         defaultViewConfig = Rating.defaultViewConfig
>         ratingViewConfig =
>             { defaultViewConfig | readOnly = model.readOnly }
>     in 
>         ...
> 
> Then everything works fine. Is this a bug in the parser?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
Dustin Farris



-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to