Infer instantiations for polymorphic arguments to polymorphic functions
Alex Knauth
Branch: infer-poly-4
infer-poly-4
Branch: master
master
Open
#21 · Created  · Last updated
Description
This is currently broken because define-type can't infer variance for recursive types.
This lets polymorphic functions be applied to polymorphic arguments without needing explicit instantiations. This also allows values such as Nil to be polymorphic, because all function applications can handle possibly polymorphic values for all of the arguments, and it instantiates them properly by handling constraints with type variables on both sides.
This is currently broken because
define-type
can't infer variance for recursive types.This lets polymorphic functions be applied to polymorphic arguments without needing explicit instantiations. This also allows values such as
Nil
to be polymorphic, because all function applications can handle possibly polymorphic values for all of the arguments, and it instantiates them properly by handling constraints with type variables on both sides.This also solves issue #15.