make (//) lazier
This commit is contained in:
parent
b29c56e0ae
commit
8c675d01d5
2 changed files with 13 additions and 11 deletions
|
@ -35,7 +35,7 @@ export Ord (f to) => Ord (Subst f from to) where compare = compare `on` repr
|
|||
infixl 8 //
|
||||
public export
|
||||
interface FromVar env => CanSubst env term where
|
||||
(//) : term from -> Subst env from to -> term to
|
||||
(//) : term from -> Lazy (Subst env from to) -> term to
|
||||
|
||||
public export
|
||||
CanSubst1 : (Nat -> Type) -> Type
|
||||
|
|
|
@ -189,9 +189,10 @@ export
|
|||
CanSubst (Elim d) (Elim d) where
|
||||
F x // _ = F x
|
||||
B i // th = th !! i
|
||||
CloE e ph // th = CloE e $ assert_total $ ph . th
|
||||
e // Shift SZ = e
|
||||
e // th = CloE e th
|
||||
CloE e ph // th = assert_total CloE e $ ph . th
|
||||
e // th = case force th of
|
||||
Shift SZ => e
|
||||
th => CloE e th
|
||||
|
||||
||| does the minimal reasonable work:
|
||||
||| - deletes the closure around an atomic constant like `TYPE`
|
||||
|
@ -204,8 +205,9 @@ CanSubst (Elim d) (Term d) where
|
|||
TYPE l // _ = TYPE l
|
||||
E e // th = E $ e // th
|
||||
CloT s ph // th = CloT s $ ph . th
|
||||
s // Shift SZ = s
|
||||
s // th = CloT s th
|
||||
s // th = case force th of
|
||||
Shift SZ => s
|
||||
th => CloT s th
|
||||
|
||||
export CanShift (Term d) where i // by = i // Shift by {env=(Elim d)}
|
||||
export CanShift (Elim d) where i // by = i // Shift by {env=(Elim d)}
|
||||
|
|
Loading…
Reference in a new issue