  A classical theorem of Herglotz states that a function $n\mapsto r(n)$ from
$\mathbb Z$ into $\mathbb C^{s\times s}$ is positive definite if and only there
exists a $\mathbb C^{s\times s}$-valued positive measure $d\mu$ on $[0,2\pi]$
such that $r(n)=\int_0^{2\pi}e^{int}d\mu(t)$for $n\in \mathbb Z$. We prove a
quaternionic analogue of this result when the function is allowed to have a
number of negative squares. A key tool in the argument is the theory of slice
hyperholomorphic functions, and the representation of such functions which have
a positive real part in the unit ball of the quaternions. We study in great
detail the case of positive definite functions.
