DEV Community

Discussion on: Encoding HKTs in TypeScript (Once Again)

Collapse
 
fkrautwald profile image
Frederik Krautwald

All interesting stuff, but what’s wrong with fp-ts?

Collapse
 
mikearnaldi profile image
Michael Arnaldi

Doesn't support transformers, every definition of a typeclass requires multiple interfaces defined (4*2, where 4 is the amount of supported parameters and 2 is the number of supported constraints, only the E can be fixed) and any definition of a function that operated on a typeclass requires the same amount of overloads.

The following is the definition of Functor in fp-ts:
github.com/gcanti/fp-ts/blob/maste...

And of a function that operated on a typeclass:
github.com/gcanti/fp-ts/blob/maste...

The following two examples of this encoding:

github.com/mikearnaldi/hkt-new/blo...
github.com/mikearnaldi/hkt-new/blo...