Phs/extract type submodules

`Type` and `TypeSpec` are enormous.  Extract some code!