fantasy-lenses icon indicating copy to clipboard operation
fantasy-lenses copied to clipboard

adds fromArray

Open stoeffel opened this issue 9 years ago • 3 comments

This adds Lens/PartialLens.fromArray. It works with arrayLens and objectLens.

objectLens('location').andThen(objectLens('numbers')).andThen(arrayLens(0))
// ===
Lens.fromArray(['location', 'numbers', 0])

How do you like it? Do you want me to change anything?

refs #2

stoeffel avatar Feb 17 '16 19:02 stoeffel

I'm in the process of moving to profunctor lenses, but I've got a lot to do on them. Unsure if we should move on this one?

SimonRichardson avatar Feb 17 '16 19:02 SimonRichardson

hmm.. If you plan on moving towards profunctor lenses as a replacement for the current implementation, then I wouldn't move on this one. Did you see https://github.com/flunc/optics? I'm interested to see your implementation.

stoeffel avatar Feb 17 '16 19:02 stoeffel

It's almost identical to that one (because it's a port of the purescript library), but I've moved out a lot of it to libraries. Hence the fantasy monoid library ;-)

On Wed, 17 Feb 2016, 19:38 Christoph Hermann [email protected] wrote:

hmm.. If you plan on moving towards profunctor lenses as a replacement for the current implementation, then I wouldn't move on this one. Did you see https://github.com/flunc/optics? I'm interested to see your implementation.

— Reply to this email directly or view it on GitHub https://github.com/fantasyland/fantasy-lenses/pull/5#issuecomment-185370005 .

SimonRichardson avatar Feb 17 '16 19:02 SimonRichardson