Right now we implement type abstraction as a field on special types. Specifically, ArrowType, and ObjectType both have a type_abs field that lists type variables that are being abstracted over. While this works, it means that we have to do a fair amount of special checking and redundant handling of both of these types. If we wanted to add a new type that could abstract over types, we would have to touch a large amount of the code base.
Adding a TypeAbs type that does the work of abstracting over types would simplify our code and make it easier to add new types. It would also make it harder to accidentally forget to pass on variables that are being abstracted over.
Right now we implement type abstraction as a field on special types. Specifically,
ArrowType, andObjectTypeboth have atype_absfield that lists type variables that are being abstracted over. While this works, it means that we have to do a fair amount of special checking and redundant handling of both of these types. If we wanted to add a new type that could abstract over types, we would have to touch a large amount of the code base.Adding a
TypeAbstype that does the work of abstracting over types would simplify our code and make it easier to add new types. It would also make it harder to accidentally forget to pass on variables that are being abstracted over.