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 12:01:01 PM UTC-7, Duane Johnson wrote: > > 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 <[email protected] > <javascript:>> wrote: > >> 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 the |, >> which one of the requirements of the the current syntax. >> >> Again. Wishful. >> >> >> On Tuesday, August 2, 2016 at 2:44:25 PM UTC-4, Ambrose Laing wrote: >>> >>> When you say >>> >>> { model.primaryForecast.parameters | q = ... } >>> >>> it seems to me that the type of the argument to the left of the '|' is >>> of the same type as model.primaryForecast.parameters, so to me, >>> this means something whose type and value is the same as >>> model.primaryForecast.parameters, except that q has been changed. >>> >>> My suggestion: >>> >>> { model | model.primaryForecast.parameters.q = ... } >>> >>> makes it clearer, I think, that what you want is of type the same as >>> model, but for which the sub sub sub field called q is changed. >>> At least that is what I meant, if I didn't mention that. >>> >>> Then if I want something whose type is the same as a primaryForecast, >>> but whose q value has changed, one could write: >>> >>> { model.primaryForecast | parameters.q = ... } >>> >>> And if I want something of same type as >>> model.primaryForecast.parameters, but with q changed, one could write: >>> >>> { model.primaryForecast.parameters | q = ... } >>> >>> Anyway, this remains wishful, ... I am yet to grok the appeal of lenses. >>> >>> On Tuesday, August 2, 2016 at 12:34:24 PM UTC-4, Robin Heggelund Hansen >>> wrote: >>>> >>>> As far as I know, there is nothing against such a syntax, though I >>>> think the preferred syntax would be `{ model.primaryForecast.parameters | >>>> q >>>> = ...}` >>>> It just haven't been implemented yet. >>>> >>> -- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
