Closed m-bock closed 3 years ago
In index.ts
there's the (class
-based) stable API while the experimental modules are pipe
-based, see https://github.com/gcanti/monocle-ts/tree/5eeb6f2f634a7b4aa91e3b6746026bb5306b15ba#experimental-modules.
I'd like to know a bit what's the roadmap with those different types of API's
monocle-ts@3.0.0
will only contain pipe
-based APIs
Ok, good to know! Now I see that's in the Readme.
🚀 Feature request
Current Behavior
Currently the API of
monocle-ts
provides modules containing functions for the core datatypes (e.g. Lens inLens.ts
, Prism inPrism.ts
, etc) as well as class wrappers around each defined inindex.ts
.As a newcomer to this library I found this a bit confusing. Certainly both approaches have their pros and cons. I'd like to know a bit what's the roadmap with those different types of API's. Having used
fp-ts
and having worked with other functional languages, I expected all I need to work with say aPrism
would be inside thePrism
module. However, I was not able to find the main constructor for this type in there. After a while I realized that it's only defined in the class wrapper inindex.ts
. And it turned out that also some other functions are only defined in there as methods (e.g. "fromProp").Desired Behavior
I think it could make sense to make the modules work standalone. The classes would then work as a wrapper for convenience for optional use.
Suggested Solution
Move all "essential" definitions from
index.ts
to the specialized modules for the datatypes.Who does this impact? Who is this for?
This would especially help to onboard people coming from languages where classes are not present. Also encourage users that prefer just functions to use the library.
Describe alternatives you've considered
Alternative would be to only provide one API. if this one should be the class based one, then I think the sub modules should be regarded as internal and therefore not exposed.
Additional context
Example for a function only lens library: https://pursuit.purescript.org/packages/purescript-profunctor-lenses