Why are repeated signature ascriptions slow? Suppose Foo is a pretty big structure, which has already been ascribed the signature FOO:
structure X = Foo; (* fast, note that poly already knows Foo, and thus X, is a FOO *)
structure X : FOO
structure X = Foo : FOO (* slow *)
structure X : FOO
structure X : FOO = Foo (* slow *)
structure X : FOO
Poly already knows that Foo is a FOO, so surely this should return instantly, but it acts like its typechecking the whole struct again. While it's not necessary to do the ascriptions above (poly is smart enough to figure out X is a FOO, even in the first case), this same issue seems to be seriously slowing down functor evaluation, where you can't avoid ascription.
I thought using opaque ascription might skirt the issue, but the same thing happens. Is poly just being silly, or this this a consequence of how the type system works?
a