>
> You might look at lenses (e.g. elm-monocle) to see one approach that might
> appeal to you.


This is pretty cool. I've often made setter functions for my records,
wrapping around Elm's regular update syntax. I didn't realize that it's
part of a larger class of patterns.

On Tue, Nov 22, 2016 at 7:13 AM, Austin Bingham <[email protected]>
wrote:

> You might look at lenses (e.g. elm-monocle) to see one approach that might
> appeal to you. Lenses are apparently frowned upon by some, but I think they
> capture the essence of what you're asking.
>
> On Tue, Nov 22, 2016 at 4:04 PM Wouter In t Velt <[email protected]>
> wrote:
>
>> Op dinsdag 22 november 2016 15:55:25 UTC+1 schreef Rex van der Spuy:
>>
>> But, can anyone explain why Elm doesn't let us do this?
>>
>>
>> My impression is that it has to do with the enforced strong typing and
>> type safety of elm.
>>
>> A record is intended for key-value type info where each value could be of
>> a different type.
>> And elm's greatness requires that elm always knows the type it is working
>> on.
>> Dynamic typing for records (which javascript does allow for objects)
>> would break this guarantee.
>>
>> So with a record, you get the flexibility that each field could be
>> whatever type, but you lose the dynamicness (is that even a word?) of the
>> keys.
>> With Dict, it is the other way around. You can get a value by supplying a
>> dynamic key, but all values in the Dict must be of the same type.
>>
>> --
>> 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.
>>
> --
> 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.
>

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