pi/src/Normalize.idr

26 lines
523 B
Idris

module Normalize
import Term
import Value
import Ctx
import Misc
import Data.Nat
%default total
public export
eval : List (Closure Term) -> Ctx Term n -> Term n -> PI NF
eval stack ctx TType = pure NType
eval stack ctx (TVar n p) = pure NType
eval stack ctx (TApp f x) = eval (MkClosure ctx x :: stack) ctx f
eval _ _ _ = oops "eval"
public export
finalize : Term 0 -> PI NF
finalize term = eval [] Nil term
-- idris can't see that there is no case for TVar itself
finalize (TVar n p) = void (succNotLTEzero p)