Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ramda lenses #3425

Merged
merged 1 commit into from
Jul 5, 2019
Merged

Conversation

LoganBarnett
Copy link
Contributor

Other notes:

The lens functions (lens, lensProp, lensIndex (excluding lensPath for today)) weren't producing a correct type in the output, so some modification was needed. The lens types relate to the lens operation functions: over, set, and view. All of the lens operation functions also needed modification to work with the new lens types.

These types should closely reflect Haskell's lens system, which itself inspires Ramda.

These forms aren't considered to be absolutely correct, but should prove more correct than the prior declarations. I do not claim to be an expert on lenses and additional scrutiny over this pull request would be much appreciated.

This also introduces Functor types, which were helpful in reasoning about lenses. Other places in Ramda respect fantasy-land types as well as a generic concept of a Functor (it has a "map"). These should be useful in other Ramda definitions going forward, as many of them also can operate on Functors.

The lens functions (lens, lensProp, lensIndex (excluding lensPath for today))
weren't producing a correct type in the output, so some modification was needed.
The lens types relate to the lens operation functions: over, set, and view. All
of the lens operation functions also needed modification to work with the new
lens types.

These types should closely reflect Haskell's lens system, which itself inspires
Ramda.

These forms aren't considered to be absolutely correct, but should prove more
correct than the prior declarations.

This also introduces Functor types, which were helpful in reasoning about
lenses. Other places in Ramda respect fantasy-land types as well as a generic
concept of a Functor (it has a "map"). These should be useful in other Ramda
definitions going forward, as many of them also can operate on Functors.
@LoganBarnett
Copy link
Contributor Author

Also

mind=blown

@goodmind
Copy link
Contributor

goodmind commented Jul 3, 2019

This facebook/flow#7879 or this facebook/flow#7860 should enable typing lensPath

@AndrewSouthpaw
Copy link
Contributor

Every time I heard reference to "fantasy-land whatevers" I just laugh to myself: no wonder people think functional programming is ludicrous. 😉

@AndrewSouthpaw AndrewSouthpaw merged commit fd46b9e into flow-typed:master Jul 5, 2019
@LoganBarnett
Copy link
Contributor Author

@goodmind Nice! I'll watch those so we might later take a pass at lensPath with them :)

@LoganBarnett LoganBarnett deleted the fix-ramda-lenses branch July 10, 2019 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants