18 lines
462 B
TypeScript
18 lines
462 B
TypeScript
// Helper functions for dealing with contexts
|
|
|
|
import { ContextEntry, Type } from "./data";
|
|
import { isEqual } from "lodash";
|
|
|
|
/** Γ |- A (is the given type in this context?) */
|
|
export function isTypeInContext(type: Type, ctx: ContextEntry[]): boolean {
|
|
for (const entry of ctx) {
|
|
switch (entry.kind) {
|
|
case "termAnnot":
|
|
if (isEqual(entry.type, type)) return true;
|
|
break;
|
|
default:
|
|
continue;
|
|
}
|
|
}
|
|
return false;
|
|
}
|