fn: breaking - polish Either API

This commit is contained in:
Keagan McClelland
2024-08-14 18:02:51 -07:00
parent c6734ea013
commit 1805fd6f19
3 changed files with 13 additions and 13 deletions

View File

@@ -99,12 +99,12 @@ func MapOk[A, B any](f func(A) B) func(Result[A]) Result[B] {
//
// Deprecated: Use OkToSome instead.
func (r Result[T]) Option() Option[T] {
return r.Either.LeftToOption()
return r.Either.LeftToSome()
}
// OkToSome mutes the error value of the result.
func (r Result[T]) OkToSome() Option[T] {
return r.Either.LeftToOption()
return r.Either.LeftToSome()
}
// WhenResult executes the given function if the Result is a success.