DEV Community

Discussion on: Encoding HKTs in TS4.1

Collapse
 
mateiadrielrafael profile image
Matei Adriel

What about this encoding? github.com/pelotom/hkts

It seems way nicer

Collapse
 
mikearnaldi profile image
Michael Arnaldi • Edited

The known limitations listed in the README.md are enough, and unfortunately the issue noted as "it might solve it" doesn't actually solve the problem.

On the same idea another attempt was recently made: github.com/TylorS/hkt-ts and it did solve part of the issues but without ending up with less boilerplate, a small discussion on this: github.com/gcanti/fp-ts/issues/1276.

Collapse
 
mateiadrielrafael profile image
Matei Adriel

Nr 2 was solved by recent ts versions and 3 is a problem with type inference in ts in general (eg: I have similar issues w fp-ts)

Nr 1 can be avoided as long as you don't use the ts equivalent of rank n types (which seems like a fair cost for the simplicity of the implementation)

But fp-ts does it the long way, so what do I know

Thread Thread
 
mikearnaldi profile image
Michael Arnaldi • Edited

Nr 1 can be avoided as long as you don't use the ts equivalent of rank n types (which seems like a fair cost for the simplicity of the implementation).

If that is your objective yes, you can probably simplify it further.

In that encoding I still don't find how to make transformers work like:
github.com/Matechs-Garage/matechs-...

Personally I prefer making the low level implementation complex (as it does not target user-land code) and provide more features that works smoothly.