Accumulate resolution and typechecking errors

Errors are aggregated where possible and sorted when
printed. This matches the error behaviour of many compilers
(e.g. GCC and GHC).