updating records syntax

69 views
Skip to first unread message

Samuel Walladge

unread,
Apr 22, 2017, 3:04:23 PM4/22/17
to Elm Discuss
I'm new to elm, and was experimenting with updating records today. Noticed something that seemed a bit strange - the elm compiler doesn't accept updating a record where you specify the record you want to update with `{ myRecord.myNestedRecord | ... }` (syntax error).

I've attached an example file displaying this behaviour. `example5` and `example6` don't compile. What I'm wondering is, should they compile based on the elm language specification? And, for example 5, when you want to update a nested record, is that nested syntax a good way to go about it, or is there a neater way?

For reference, this is the error I get when compiling:

-- SYNTAX PROBLEM ----------------------------------------------------- Test.elm

I ran into something unexpected when parsing your code!

24| example6 = { myRecord.user | name = "John" }
 ^
I am looking for one of the following things:

 "'"
 "|"
 an equals sign '='
 more letters in this name
 whitespace

Detected errors in 1 module.


Thanks.

Test.elm

Dustin Farris

unread,
Apr 22, 2017, 3:25:02 PM4/22/17
to elm-d...@googlegroups.com
There is ongoing discussion around this.  You might consider posting your specific scenario here: https://groups.google.com/forum/#!searchin/elm-discuss/record%7Csort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ

Dustin

--
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 elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Test.elm>

-- 
Dustin Farris



Reply all
Reply to author
Forward
0 new messages