If I'm not mistaken, this isn't so much about nested records as it is about 
referencing a qualified record in a record update expression.

This seems related to - but not exactly the same thing as 
- https://github.com/elm-lang/elm-compiler/issues/1549

So yeah, you could either create a local binding for it, use an extra 
helper function like Peter described, or expose `defaultViewConfig` in your 
imports so you can use it unqualified.

I've created a new issue for this 
- https://github.com/elm-lang/elm-compiler/issues/1587

Op zondag 23 april 2017 09:42:12 UTC+2 schreef Peter Damoc:
>
> On Sat, Apr 22, 2017 at 11:50 AM, Dwayne Crooks <[email protected] 
> <javascript:>> wrote:
>
>> However, if I update the let bindings as follows:
>>
>>     let
>>>         defaultViewConfig = Rating.defaultViewConfig
>>>         ratingViewConfig =
>>>             { defaultViewConfig | readOnly = model.readOnly }
>>>     in
>>>         ...
>>
>>
>> Then, there is no error. Am I missing something or is this a bug in the 
>> parser?
>>
>> This is related to an active topic around record update syntax. 
> In short, currently it is not allowed to directly update nested records. ({ 
> Rating.defaultViewConfig | readOnly = model.readOnly } is invalid syntax) 
> The temporary solution is the one you stumbled upon: creating an alias for 
> the nested record. 
>
> Another solution would be to use custom functions:
>
>
> updateReadOnly : { a | readOnly : Bool } -> Bool -> a
> updateReadOnly rec readOnly =
>     { rec | readOnly = readOnly }
>
> and then use it like: 
>
> ratingViewConfig =
>     updateReadOnly Rating.defaultViewConfig True
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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