Check that declared types are instances of inferred.

WIP for #94.