  Polynomial functors are a categorical generalization of the usual notion of
polynomial, which has found many applications in higher categories and type
theory: those are generated by polynomials consisting a set of monomials built
from sets of variables. They can be organized into a cartesian bicategory,
which unfortunately fails to be closed for essentially two reasons, which we
address here by suitably modifying the model. Firstly, a naive closure is too
large to be well-defined, which can be overcome by restricting to polynomials
which are finitary. Secondly, the resulting putative closure fails to properly
take the 2-categorical structure in account. We advocate here that this can be
addressed by considering polynomials in groupoids, instead of sets. For those,
the constructions involved into composition have to be performed up to
homotopy, which is conveniently handled in the setting of homotopy type theory:
we use it here to formally perform the constructions required to build our
cartesian bicategory, in Agda. Notably, this requires us introducing an
axiomatization in a small universe of the type of finite types, as an
appropriate higher inductive type of natural numbers and bijections.
