Lenses with Immutable.js
Brian Lonsdorf
1395

One thing I’ve been trying to figure out is why view acts like this when using mapped in a composition:

Basically, the first case is sort of what I’d expect: view is dealing with an array, mapping over it, getting the street, and the whole deal comes back in an array.

But in the second case, it gets back the street elements of the array as before… but also the original structure of the original object.

While it surprised me at first, there’s almost certainly nothing wrong here with that result (and it might even be useful if that’s the desired structure for a result!), but I’ve just had a hard time working through what’s actually happening to get there, and I think it’s probably because one or both of my mental models of composing with a mapped and/or view is probably wrong.