-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add fromReaderEither and fromReaderTaskEither #33
base: main
Are you sure you want to change the base?
Conversation
Originally, I wrote ruins so people who don't want to learn functional programming could work with a functional API without having to learn new things. Writing
Let's now consider how the same example would work with
If this seems like worth doing, and if we decided to go with non-curried implementation, then it would perhaps make sense to have deps as second argument. I would imagine that deps would more typically be the second argument in this kind of calls, since that might make using some default parameter solutions easier. |
For a moment I thought we could perhaps create overloads to make the dependencies optional in situations where they have some trivial type like
This would work better in the curried form since we could necessitate a specific kind of Reader through the initial call.
However, at this point it becomes a question of whether we want a more powerful FP-esque implementation, or a more procedural less powerful one. |
Technically it would be possible to also implement "kontra position" versions of these and all other tools already present in the ruins package. For example
If we had such
I was hoping we could use such kontra position variants in their point-free form. However, TypeScript seems to have some short comings in how it deals with typings of point-free functions. I think it is somehow related to how the official ResultType utility type does not take into account generics and overloads. See gcanti/fp-ts#1769 Also, kontra position variants feel a bit more advanced in general than the other utils we have so far included in the package. It is tempting to add all kinds of powerful bells and whistles but I am wondering how far we can stretch the feature set before this becomes an advanced utility library rather than a newbie survival kit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we close this?
The use-case is for jest tests.
E.g.
Or possibly:
can become:
Although, maybe it's better to look at this:
https://github.com/relmify/jest-fp-ts
NOTE: if this is accepted, need to add new functions to README