  We give an explicit construction of Haar functions associated to a system of
dyadic cubes in a geometrically doubling quasi-metric space equipped with a
positive Borel measure, and show that these Haar functions form a basis for
$L^p$. Next we focus on spaces $X$ of homogeneous type in the sense of Coifman
and Weiss, where we use these Haar functions to define a discrete square
function, and hence to define dyadic versions of the function spaces $H^1(X)$
and ${\rm BMO}(X)$. In the setting of product spaces $\widetilde{X} = X_1
\times \cdots \times X_n$ of homogeneous type, we show that the space ${\rm
BMO}(\widetilde{X})$ of functions of bounded mean oscillation on
$\widetilde{X}$ can be written as the intersection of finitely many dyadic
${\rm BMO}$ spaces on $\widetilde{X}$, and similarly for $A_p(\widetilde{X})$,
reverse-H\"older weights on $\widetilde{X}$, and doubling weights on
$\widetilde{X}$. We also establish that the Hardy space $H^1(\widetilde{X})$ is
a sum of finitely many dyadic Hardy spaces on $\widetilde{X}$, and that the
strong maximal function on $\widetilde{X}$ is pointwise comparable to the sum
of finitely many dyadic strong maximal functions. These dyadic structure
theorems generalize, to product spaces of homogeneous type, the earlier
Euclidean analogues for ${\rm BMO}$ and $H^1$ due to Mei and to Li, Pipher and
Ward.
