Add monad, quote/eval broken
This commit is contained in:
@@ -16,7 +16,15 @@ parameters {0 m : Type -> Type} {auto _ : MonadError String m}
|
||||
export
|
||||
check : Context -> Raw -> Val -> m Tm
|
||||
|
||||
check ctx (RLam _ _ _) ty = ?ch_rhs
|
||||
check ctx (RLam nm icit tm) ty = case ty of
|
||||
(VPi pinm icit a b) => do
|
||||
-- TODO icit
|
||||
let var = VVar (length ctx.env)
|
||||
let ctx' = extend ctx nm a
|
||||
tm' <- check ctx' tm (b var)
|
||||
pure $ Lam nm icit tm'
|
||||
|
||||
other => throwError "Expected pi type \{show $ quote 0 ty}"
|
||||
check ctx tm ty = do
|
||||
(tm', ty') <- infer ctx tm
|
||||
if quote 0 ty /= quote 0 ty' then
|
||||
|
||||
@@ -32,6 +32,19 @@ data Tm : Type where
|
||||
|
||||
%name Tm t, u, v
|
||||
|
||||
public export
|
||||
Show Tm where
|
||||
show (Bnd k) = "Bnd \{show k}"
|
||||
show (Ref str) = "Ref \{show str}"
|
||||
show (Lam nm Implicit t) = "(λ {\{nm}} => \{show t})"
|
||||
show (Lam nm Explicit t) = "(λ \{nm} => \{show t})"
|
||||
show (App t u) = "(\{show t} \{show u})"
|
||||
show U = "U"
|
||||
show (Pi str icit t u) = "(∏ \{str} : \{show t} => \{show u})"
|
||||
show (Let str icit t u v) = "let \{str} : \{show t} = \{show u} in \{show v}"
|
||||
|
||||
-- I can't really show val because it's HOAS...
|
||||
|
||||
-- TODO derive
|
||||
export
|
||||
Eq Icit where
|
||||
|
||||
Reference in New Issue
Block a user