| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- The TC (Type Checking) monad |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Reflection.TCM where |
| 10 |
|
| 11 |
import Agda.Builtin.Reflection as Builtin |
| 12 |
|
| 13 |
open import Reflection.AST.Term |
| 14 |
import Reflection.TCM.Format as Format |
| 15 |
|
| 16 |
------------------------------------------------------------------------ |
| 17 |
-- Type errors |
| 18 |
|
| 19 |
open Builtin public |
| 20 |
using (ErrorPart; strErr; termErr; nameErr) |
| 21 |
|
| 22 |
------------------------------------------------------------------------ |
| 23 |
-- The monad |
| 24 |
|
| 25 |
open Builtin public |
| 26 |
using |
| 27 |
( TC; bindTC; unify; typeError; inferType; checkType |
| 28 |
; normalise; reduce |
| 29 |
; catchTC; quoteTC; unquoteTC |
| 30 |
; getContext; extendContext; inContext; freshName |
| 31 |
; declareDef; declarePostulate; defineFun; getType; getDefinition |
| 32 |
; blockOnMeta; commitTC; isMacro; withNormalisation |
| 33 |
; debugPrint; noConstraints; runSpeculative |
| 34 |
; Blocker; blockerMeta; blockerAny; blockerAll; blockTC |
| 35 |
) |
| 36 |
renaming (returnTC to pure) |
| 37 |
|
| 38 |
open Format public |
| 39 |
using (typeErrorFmt; debugPrintFmt; errorPartFmt) |
| 40 |
|
| 41 |
------------------------------------------------------------------------ |
| 42 |
-- Utility functions |
| 43 |
|
| 44 |
newMeta : Type → TC Term |
| 45 |
newMeta = checkType unknown |