AnyTerm.(.def) => (.get)

This commit is contained in:
rhiannon morris 2023-01-08 15:07:01 +01:00
parent 98fa8d9967
commit 9dbd0b066c
3 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import public Control.Monad.State
public export
record AnyTerm where
constructor T
def : forall d, n. Term d n
get : forall d, n. Term d n
public export
record Definition where
@ -33,11 +33,11 @@ MkAbstract {qty, type} =
public export %inline
(.type0) : Definition -> Term 0 0
g.type0 = g.type.def
g.type0 = g.type.get
public export %inline
(.term0) : Definition -> Maybe (Term 0 0)
g.term0 = map (\t => t.def) g.term
g.term0 = map (\t => t.get) g.term
public export %inline
(.qtyP) : Definition -> Subset Qty IsGlobal

View File

@ -37,7 +37,7 @@ parameters {auto _ : MonadError Error m} {auto _ : MonadReader Env m}
defE : Name -> m (Maybe (Elim d n))
defE x = asks $ \env => do
g <- lookup x env.defs
pure $ (!g.term).def :# g.type.def
pure $ (!g.term).get :# g.type.get
private %inline
defT : Name -> m (Maybe (Term d n))

View File

@ -129,7 +129,7 @@ parameters {auto _ : CanTC m}
infer' ctx sg (Element (F x) _) = do
Just g <- asks $ lookup x | Nothing => throwError $ NotInScope x
when (isZero g) $ expectEqualQ sg Zero
pure $ InfRes {type = g.type.def, qout = zero}
pure $ InfRes {type = g.type.get, qout = zero}
infer' ctx sg (Element (B i) _) =
pure $ lookupBound sg i ctx