Hello,
in haskell it's possible to convert some data type to it CPS'ed form using rank-N polymorphism.
I'm trying to do the same in ocaml using objects with polymorphic methods (instead of GHC RankNTypes extension), and it works well unless I'm using data type with existential type variables.
Example - https://gist.github.com/anonymous/57262e4e1009e658b97e8986a2d03d40
Haskell version compiles, while ocaml version gives type error about universal variable escaping it's scope.
What is the right way to do this? Is it possible at all?
Thanks.