/** If you want to know how to encoding HKTs in typescript, check this: https://gist.github.com/ENvironmentSet/1662a140f99381bc85fd6be51ecdcbb5 Sorry for messy names, this was only PoC. **/ export interface HKT { param: unknown; result: unknown; } export type Apply = (f & { param: x })['result']; export type ElimWithConstraint = (f: (x: Apply) => R) => R; export function makeElimWithConstraint(): (x: Apply) => ElimWithConstraint { return x => f => f(x); }