I recently discovered how to simulate higher order types in Java in a somewhat roundabout way like so
interface H<F, T> { }
Here H encodes a higher order type that takes a type parameter F which itself takes parameter T.
Now this leaves me to wonder, can we use this to implement some more advanced constructs? E.g. fixed point of functors like Fix in Haskell and its corresponding catamorphisms?
Indeed this can be done by carefully translating the corresponding Haskell counterparts. Although this introduces a lot of line noise, the implementation is quite close to the original:
Amazingly this works and can be used to implement e.g. interpreters for expression algebras
Full working example in my GitHub repository.