Re: [elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Ambrose Laing
In the previous posting there is a bug -- I should simply use e = ... instead of e = f ... If you want to make the previous write up work, then you need f : X -> E and ... is of type X rather than the following which is a mistake. f: E -> X and ... is of type E On Tuesday, August 2,

Re: [elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Austin B
I think that would be the case. Although, I'd imagine I'd be using dictionaries in this situation once I get to the point of having "Maybe" data in this particular example. I am beginning to understand the value of flattening data structures in this context. On Tuesday, August 2, 2016 at

[elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Austin B
Hi all, I really appreciate the ample feedback. As I am new to the functional style, Sergey, your input is extremely helpful. For some reason, I felt like I was supposed to have all my modifiers and data structure definitions in one place, which became unmanageable. I am currently refactoring

Re: [elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Duane Johnson
I like the syntax. It's intent is clear. However, correct me if I'm wrong, but it would only work for records of records, correct? No way to deal with a "Maybe Forecast", right? On Tue, Aug 2, 2016 at 12:53 PM, Ambrose Laing wrote: > Correction: what I should have written is:

[elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Ambrose Laing
Correction: what I should have written is: { model | primaryForecast.parameters.q = ... } instead of { model | model.primaryForecast.parameters.q = ... } because the former is more consistent with the notion that the field between the | and the = must exist inside the record to the left of

[elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Anton Lorenzen
I think we should wait for Elm to get typeclasses and use lenses for that. https://en.wikibooks.org/wiki/Haskell/Lenses_and_functional_references -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving

[elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Anton Lorenzen
You might want to look into the Focus library: http://package.elm-lang.org/packages/evancz/focus/2.0.1/ But as you probably want to render your data as html, I would recommend you to break your data into modules and use the Elm Architecture:

[elm-discuss] Re: How are deeply nested records updated or what alternatives are typically used?

2016-08-02 Thread Robin Heggelund Hansen
As far as I know, this is how you must do at present. It's a recorded issue though (https://github.com/elm-lang/elm-compiler/issues/1375) so it will hopefully be fixed in a future release. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To