Added support for generating functor instances