chore: deprecate Option.toBool in favour of Option.isSome (#3866)

This commit is contained in:
Kim Morrison 2024-04-22 09:20:19 +02:00 committed by GitHub
parent 7a65bde3e3
commit 7c34b736fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View file

@ -10,7 +10,7 @@ import Init.Control.Except
universe u v
instance : ToBool (Option α) := ⟨Option.toBool
instance : ToBool (Option α) := ⟨Option.isSome
def OptionT (m : Type u → Type v) (α : Type u) : Type v :=
m (Option α)

View file

@ -21,15 +21,13 @@ def getM [Alternative m] : Option α → m α
@[deprecated getM] def toMonad [Monad m] [Alternative m] : Option α → m α :=
getM
@[inline] def toBool : Option α → Bool
| some _ => true
| none => false
/-- Returns `true` on `some x` and `false` on `none`. -/
@[inline] def isSome : Option α → Bool
| some _ => true
| none => false
@[deprecated isSome, inline] def toBool : Option α → Bool := isSome
/-- Returns `true` on `none` and `false` on `some x`. -/
@[inline] def isNone : Option α → Bool
| some _ => false