Why do some "finite versions" of contravariant constructions become covariant? If we look at the De Rham cohomology of a space, the normal functor $H^n$ is contravariant. Yet when we restrict our attention to those forms which have compact support, the resulting functor $H^n_C$ is covariant.
Similarly, for a fixed field $K$, the functor $K^{(-)}$ sending a set $X$ to the vector space of functions $X \to K$ is contravariant... until one restricts attention to functions defined on a finite subset of $X$. The new functor $K[-]$ is the free vector space with basis $X$, and is a covariant functor.
One can also use abelian groups, and consider $\mathbb{Z}^X$ vs $\mathbb{Z}[X]$ as above, but this doesn't feel like a really new example.

Is there some general principle here? Or am I reading too far into things? The proofs that $H^n_C$ and $K[-]$ are covariant are relatively different, so this observation may be a coincidence. Obviously there is some generalization from $K$ and $\mathbb{Z}$ as above into general free $R$-modules, but I'm curious if there is anything more.

Thanks in advance ^_^
 A: This is a long story. There are two distinct but related phenomena here: 


*

*Many contravariant constructions can be thought of as "pulling back" functions or some variation of functions along maps $f : X \to Y$ of "spaces" in some sense. In special cases this "pulling back" operation can be reversed into a "pushforward" operation which, loosely speaking, is given by "integration along the fibers" of $f$, which isn't always possible. 

*Some constructions come in two flavors, a contravariant "function" version (that pulls back) and a covariant "distribution" version (that pushes forward), and sometimes the "distribution" version looks like a "compact support" version of the "function" version. 
The easiest version of this occurs when $X, Y$ are sets. Then:


*

*If $K$ is, say, a commutative ring, then we can pull back functions $K^Y \to K^X$ along maps $f : X \to Y$ of sets. If $f$ has finite fibers, then we can also push forward functions, as follows: if $r \in K^X$ is a function, then define the pushforward $f_{\ast}(r) \in K^Y$ to be the function $f_{\ast}(r)(y) = \sum_{x \in f^{-1}(y)} r(x)$. Note that pullback is a ring homomorphism but pushforward isn't; this is typical. 

*Again if $K$ is a commutative ring, then instead of functions $K^X$ we can work with functions with finite support $K[X]$, and these push forward (and don't pull back). From the point of view of algebraic topology this is zeroth homology $H_0(X, K)$, whereas functions are zeroth cohomology $H^0(X, K)$. Note that $H^0$ is the linear dual of $H_0$ and pullback is the dual of pushforward. 
For more complicated variations see e.g. cohomology with compact support, compactly supported distributions, and fiber integration. This stuff is relevant, for example, for generalizing Poincaré duality to noncompact manifolds.  
Here is a variation where no compactness / finiteness is necessary: if $f : X \to Y$ is a map between sets, we get a pullback $P(Y) \to P(X)$ from subsets of $Y$ to subsets of $X$ given by taking preimages. But we also have a pushforward given by taking images, with no additional hypotheses. These are adjoint in the categorical sense, thinking of the poset of subsets as a category; also note that pullback is a homomorphism of Boolean algebras but pushforward isn't. 
There's a further categorical variation of this story where the things we're pushing forward and pulling back are variations of sheaves. 
