Use FunctionType

This pull request refactors the codebase to use the new `lang.FunctionType` class introduced in xp-framework/rfc#286