add let to the core
This commit is contained in:
parent
68d8019f00
commit
b1699ce022
13 changed files with 234 additions and 136 deletions
|
@ -222,6 +222,25 @@ eraseTerm ctx ty (Box val loc) = do
|
|||
Erased => pure $ Erased loc
|
||||
Kept => eraseTerm ctx a val
|
||||
|
||||
-- s ⤋ s' ⇐ A
|
||||
-- ----------------------------
|
||||
-- let0 x = e in s ⤋ s' ⇐ A
|
||||
--
|
||||
-- e ⤋ e' s ⤋ s' ⇐ A π ≠ 0
|
||||
-- -------------------------------------
|
||||
-- letπ x = e in s ⤋ let x = e' in s'
|
||||
eraseTerm ctx ty (Let pi e s loc) = do
|
||||
let x = s.name
|
||||
case isErased pi of
|
||||
Erased => do
|
||||
ety <- computeElimType ctx SZero e
|
||||
s' <- eraseTerm (extendTy pi x ety ctx) (weakT 1 ty) s.term
|
||||
pure $ sub1 (Erased e.loc) s'
|
||||
Kept => do
|
||||
EraRes ety e' <- eraseElim ctx e
|
||||
s' <- eraseTerm (extendTy pi x ety ctx) (weakT 1 ty) s.term
|
||||
pure $ Let x e' s' loc
|
||||
|
||||
-- e ⤋ e' ⇒ B
|
||||
-- ------------
|
||||
-- e ⤋ e' ⇐ A
|
||||
|
|
|
@ -96,11 +96,6 @@ public export
|
|||
Definitions = SortedMap Name Definition
|
||||
|
||||
|
||||
export
|
||||
letD, inD : {opts : LayoutOpts} -> Eff Pretty (Doc opts)
|
||||
letD = hl Syntax "let"
|
||||
inD = hl Syntax "in"
|
||||
|
||||
export covering
|
||||
prettyTerm : {opts : LayoutOpts} -> BContext n ->
|
||||
Term n -> Eff Pretty (Doc opts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue