I wonder if GADTs will ever become endorsed by the ReScript team. I find them definitely harder to grasp than monadic let or most of the infix operators
They aren’t a problem in the same way as infix operators. When an infix operator is used in a popular library it means that everyone’s code using the library become harder to read as a result (Like lens in Haskell). Monadic operators also add overhead and a learning curve for the user consuming the library. Contrast this with GADTs, where libraries that use them produce better DX for the consumer of the library without really making it harder to use. A user can use a library with GADTs without any knowledge whatsoever as GADTs become an implementation detail. Personally, it’s a feature I really miss when using Typescript .
With that said, if GADTs where used everywhere and you couldn’t really start using the language without knowing them I would respect the decision not to include them in Rescript more.
One key point here is that you don’t have to fully understand all forms of variants or the theory behind them in order to get benefits. Maybe beginners start using them as enums, union types, they learn about exhaustiveness, sum/product types and other concepts and eventually they’ll come up with clean / expressive models using ADTs by experimenting or reading articles etc. I mean it’s not like “If you want to use them read these academic papers or book X”, use them as much as you like or what is enough for you/your team and enjoy the benefits.
Anyway I think this feature is a selling point for rescript. It’s common in js/ts community to mimic ADT behaviour using external libraries, noisy tags or string abuse.
Unfortunately not always. GADT require careful knowledge of sometime annotating call sites.
They’re an ok feature. A bit abused in the past community, which we hope won’t happen again.
Hi, I don’t think you should be too worried about we’re going to remove language features.
We only remove things when the benefit justifies it, you can say that we may discourage its wild use but we are not going to make a dumb language