simple primitive implementation of polymorphic instance generation