Why aren't spaces contravariant functors? The functor of points approach to algebraic geometry often starts with the definition of a k-space as an object in the functor category $\mathsf{Sp}_k=\mathrm{Fun}(\mathsf{Comm}_k,\mathsf{Set})$. That is, a covariant functor from the category of commutative $k$-algebras to the category of sets.
We can define $\mathsf{Aff}_k=\mathsf{Comm}_k^{\mathrm{op}}$ and then rewrite $\mathsf{Sp}_k=\mathrm{PShv}(\mathsf{Aff}_k)=\mathrm{Fun}(\mathsf{Comm}_k,\mathsf{Set})$.
But a motivating example for the functor of points approach is by thinking of $\mathrm{Hom}(-,B)$, a contravariant functor, as a space, where we map a commutative $k$-algebra $A$ to some set of points in $B^n$ (when $A$ is finitely generated) determined by $A$.
What am I doing wrong here?
I'm sure I must have got lost amidst all the opposites somewhere, but can't track it down.
 A: The motivation for the functor of points is actually $\operatorname{Hom}(-, \operatorname{Spec}(B))$, which, when composed with $\operatorname{Spec}$, gives the functor $\operatorname{Hom}(B,-) : \mathsf{Comm} \to \mathsf{Set}$. It's a contravariant functor when defined on schemes, and a covariant functor when defined on commutative algebras (through $\operatorname{Spec}$). Then you replace $\operatorname{Spec}(B)$ by a more general scheme $X$ to get $\operatorname{Hom}_{\mathsf{Sch}}(-,X)$.
To recall it easily, recall the affine line $\mathbb{A}^1 = \operatorname{Spec} k[x]$: one has
$$\operatorname{Hom}_{\mathsf{Comm}_k}(k[x], A) \cong A, \quad f \mapsto f(x)$$
(which is what one would expect from a 1-dimensional line), and this is also $\operatorname{Hom}_{\mathsf{Sch}}(\operatorname{Spec} A, \mathbb{A}^1)$.
A: The typical example used to motivate the functor of points approach is actually the covariant functor $\text{Hom}(B,-):\text{Comm}_k \rightarrow \text{Set}$. Here's a basic example as to why: suppose $B = k[x_1, \dots, x_n]/I$ where $I$ is an ideal generated by polynomials $g_1, \dots, g_m$, and let $X = \text{Spec}(B)$. Then $k$-algebra morphisms $B\rightarrow R$ correspond to simultaneous solutions of the polynomials $g_1, \dots, g_m$ in $R$, so the set $\text{Hom}(B,R)$ of all such morphisms corresponds to the set of points $X(R) = \left\{P\in R^n: g_i (P) = 0, \forall i\right\}$. From a geometrical point of view, the functor $\text{Hom}(B,-)$ produces the set of points of a "variety" in $R^n$, cut out by the polynomials generating $I$, in a way compatible with morphisms.
Thinking categorically, $\text{Hom}(B,-)$ is "the same" as the presheaf $\text{Hom}(-,\text{Spec}(B))$ on the category of affine schemes, which via the Yoneda lemma is the image of $\text{Spec}(B)$ in the larger category of presheaves on the category of affine schemes. This is the identification between a space $\text{Spec}(B)$  and the presheaf it represents.
