On Friday, March 3, 2017 at 6:16:15 AM UTC, Richard Feldman wrote:
>
> Re-posting the first example from Franscisco's thread
> <https://groups.google.com/forum/#!topic/elm-discuss/vzcrRdgY1-w>:
>
I think item 2 from Franscisco's thread is looking for an easy way to add
and remove fields from a record, producing a new record with a different
type. Let me just abuse the list append (++) operator to give the idea of
how a field would be added:
someRecord ++ { newField = "blah" }
The long hand version might be
addNewField someRecord =
{ newField = "blah", someRecord.existingField1,
someRecord.existingField2, ... }
Not sure how I feel about operations that produce records of a different
type, but if its really just syntax sugar for something you can write out
in long hand, it does not seem so unreasonable.
--
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.