feat: add getConstInfoDefn

This commit is contained in:
Gabriel Ebner 2022-07-07 10:55:04 +02:00 committed by Leonardo de Moura
parent 3776e3c925
commit 5024c15a7a

View file

@ -97,6 +97,11 @@ def mkConstWithLevelParams [Monad m] [MonadEnv m] [MonadError m] (constName : Na
let info ← getConstInfo constName
return mkConst constName (info.levelParams.map mkLevelParam)
def getConstInfoDefn [Monad m] [MonadEnv m] [MonadError m] (constName : Name) : m DefinitionVal := do
match (← getConstInfo constName) with
| ConstantInfo.defnInfo v => pure v
| _ => throwError "'{mkConst constName}' is not a definition"
def getConstInfoInduct [Monad m] [MonadEnv m] [MonadError m] (constName : Name) : m InductiveVal := do
match (← getConstInfo constName) with
| ConstantInfo.inductInfo v => pure v