functorize Algorithm W, so the code can be reused during a monomorphizing pass
add minimal support for user-defined type constraints in the type inference engine