Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This refactors and improves the
#eval
command, introducing some new features.ToExpr
and pretty printing. This means hoverable output. IfToExpr
fails, it then triesRepr
and thenToString
. Theeval.pp
option controls whether or not to tryToExpr
.Repr
instances, enabled with thepp.derive.repr
option (default to true). For example:deriving instance Repr for Baz
when there's no way to representBaz
. If core Lean getsToExpr
derive handlers, they could be used here as well.eval.type
controls whether or not to include the type in the output. For now the default is false.#eval do return 2
work. It tries usingCommandElabM
,TermElabM
, orIO
when the monad is unknown.Lean.Eval
orLean.MetaEval
. These each used to be responsible for both adapting monads and printing results. The concerns have been split into two. (1) TheMonadEval
class is responsible for adapting monads for evaluation (it is similar toMonadLift
, but instances are allowed to use default data when initializing state) and (2) finding a way to represent results is handled separately.MonadEval
class applies, then the error message will be specific about missingToExpr
/Repr
/ToString
instances.Repr
/ToString
instances can't be found by unfolding types "under the monad". For example, this works now:m Unit
never prints a blank message.MetaM
andCoreM
wouldn't collect log messages.The
run_cmd
,run_elab
, andrun_meta
commands are now frontends for#eval
.