tcmts.core.shape

Types

QueryImport type
Where a name in a query comes from: a `#codebase` shim module and the name it exports.
Shape type
ShapeMatch type
How a definition's type relates to a query. Lower cost is closer; 0 is the same type up to renaming.
Subst type
TypeShape type
A term's type: one shape per call signature (overloads), or the one shape of a non-function value.

Server

queryShape (text: string, file: string, options: CompilerOptions, resolve: (name: string) => QueryImport | und…
The shape of a type written as a query, e.g. `(xs: T[]) => T` or `(u: lib.User) => Promise<string>`. `resolve` maps names written in the query (`User`, `lib.User`) to codebase types; names that are neither those nor globals become type variables, as in Unison (`(xs: a[]) => a`). The query is checked as a file at `file` (it must sit where `#codebase` resolves); it's never written to disk.

Shared

MAX_DEPTH 6
MAX_PROPS 40
cacheRefOf (checker: Checker) => (sym: Symbol) => string | undefined
The hash of a codebase type a symbol denotes, when it's declared in a generated cache module.
key (s: Shape) => string
matchOne (q: Shape, d: Shape) => ShapeMatch | undefined
Match one query shape against one definition shape: in order, with arguments reordered, or with the result awaited.
matchShapes (query: TypeShape, def: TypeShape) => ShapeMatch | undefined
The closest way a definition's type answers a query, if any (over the definition's overloads).
permutations <T>(xs: T[]) => T[][]
shapeBuilder (checker: Checker, refOf: (sym: Symbol) => string | undefined) => { typeShape(t: Type): TypeShape; }
Shapes from checker types. `refOf` says which symbols are codebase types (by hash).
unify (a: Shape, b: Shape, s: Subst) => boolean