Discussion:
[elm-discuss] destructuring two of the same record
Brian Marick
2017-05-30 22:02:19 UTC
Permalink
Suppose I have a function of this type:

friendlyName2 : { whole | id : Int, name : String }
-> { whole | id : Int, name : String }
-> String

Is there a way I can destructure both of those arguments at once? Something that lets me do this:

friendlyName2 {name, id} {name, id} =
...


… except that the latter who variables would need to be something like `name2` and `id2`?

(I know it’s easy to dereference the whole record:

friendlyName2 {name, id} other =
… other.name …

… but I’m curious if I’m missing syntax.
--
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.
Loading...