Open nythrox opened 3 years ago
Fantasy Land support has been removed for good in v2.0, the discussion is here: https://github.com/gcanti/fp-ts/issues/823
To try to give more context, here is another discussion about fantasy-land compatibility https://github.com/gcanti/fp-ts/issues/204 what I understand after a quick read is that it's hard and not worth it to implement in Typescript.
To be more precise, and correct me if I'm wrong, Typescript would need to implement Higher Kinded Type. And this day may never come https://github.com/microsoft/TypeScript/issues/1213 I'm not smart enough to investigate if fp-ts implem of HKT would be enough tho
loads of messages in these discussions, hard to follow and understand all
🚀 Feature request
Is it possible to have support for both fantasy-land and static land? This way it would be possible to have "global" functions (like map, that would work on all functors) making using module namespaces optional, and it would also be possible to use fp-ts in a non-pointfree way. This would also allow us to use the generator* do-notation more easily.
Current Behavior
Currently it's only possible to operate on ADTs by importing the namespace-specific functions, and this can ruin the readability of the code. It's also not possible to use fp-ts with methods, that can sometimes be helpfull.
Desired Behavior
It would be nice to have support for both pointless and class methods, and this would allow a lot of different possibilities.
Global functions that work on all HKTs
Use either pointfree or methods
Possibility of do* notation on all supported ADTs
Suggested Solution
All ADTs that are constructed by constructors will also come with their module methods. Types that are not constructed by the constructor will still be able to be used normally with module functions.
Who does this impact? Who is this for?
This will help codebases look much cleaner with global functions, and also help beginners to understand better the code.
Describe alternatives you've considered
No other typescript libraries have these features currently, but I think fp-ts could support this with its implementation of HKTs, and maybe using varadic tuples to better express generic types.