chore: fix a typo in the docstring for SeqRight and add documentation to getLevel (#10866)

This commit is contained in:
Sebastian Graf 2025-10-21 11:07:24 +02:00 committed by GitHub
parent 916125ae1c
commit 2eb44b3cdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -3703,7 +3703,7 @@ When thinking about `f` as potential side effects, `*>` evaluates first the left
argument for their side effects, discarding the value of the left argument and returning the value
of the right argument.
For most applications, `Applicative` or `Monad` should be used rather than `SeqLeft` itself.
For most applications, `Applicative` or `Monad` should be used rather than `SeqRight` itself.
-/
class SeqRight (f : Type u → Type v) : Type (max (u+1) v) where
/--

View file

@ -129,6 +129,12 @@ private def inferProjType (structName : Name) (idx : Nat) (e : Expr) : MetaM Exp
def throwTypeExpected {α} (type : Expr) : MetaM α :=
throwError "type expected{indentExpr type}"
/--
If `type : sort` and `sort` reduces to `Sort u` for some `u`, then `getLevel type` returns `u`.
If `sort` is an assignable MVar, then `getLevel type` produces a fresh level metavariable `?u`,
assigns the MVar to `Sort ?u` and returns `?u`.
-/
def getLevel (type : Expr) : MetaM Level := do
let typeType ← inferType type
let typeType ← whnfD typeType