Add support for recursive types in polymorphic functions