less prototype, less bad code implementation of CCHM type theory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
927 B

  1. export class Program { };
  2. export class Environment { };
  3. export class Value { };
  4. export type Posn = {
  5. posnLine: number,
  6. posnColm: number
  7. };
  8. export type Range = [Posn, Posn];
  9. export type CubicalT = {
  10. exports: {
  11. parseFromStringJs(s: string): Promise<Program>;
  12. newEnvironment(): Promise<Environment>;
  13. typeCheckProgram(p: Environment, e: Program): Promise<Environment>;
  14. zonkAndShowTypeJs(val: Value): Promise<string>;
  15. getTypeByNameJs(name: string, e: Environment): Promise<Value>;
  16. getValueByNameJs(name: string, e: Environment): Promise<Value>;
  17. classifyValueByNameJs(name: string, e: Environment): Promise<string>;
  18. findDefinitionJs(name: string, e: Environment): Promise<Range | null>;
  19. }
  20. };
  21. export const waitForLoad : Promise<CubicalT> = new Promise(resolve =>
  22. document.addEventListener('cubicalLoaded', () => {
  23. resolve((window as unknown as { cubical: CubicalT}).cubical)
  24. }));