examples/modint.jl: make the ModInt type immutable.
Pkg: make Pkg.Resolve interface purely functional.

This is a first step towards refactoring Pkg in such a way that it
can actually be tested. Since this is now purely functional, it can
be tested without needing to have git repos or any other Pkg stuff.