fn: breaking - remove deprecated Result functions

This commit is contained in:
Keagan McClelland 2024-08-14 18:04:14 -07:00
parent 1805fd6f19
commit be50dd9acb
No known key found for this signature in database
GPG Key ID: FA7E65C951F12439

View File

@ -64,15 +64,6 @@ func (r Result[T]) IsErr() bool {
return r.IsRight()
}
// Map applies an endomorphic function to the success value if it exists.
//
// Deprecated: Use MapOk instead.
func (r Result[T]) Map(f func(T) T) Result[T] {
return Result[T]{
MapLeft[T, error](f)(r.Either),
}
}
// MapOk applies an endomorphic function to the success value if it exists.
func (r Result[T]) MapOk(f func(T) T) Result[T] {
return Result[T]{
@ -95,25 +86,11 @@ func MapOk[A, B any](f func(A) B) func(Result[A]) Result[B] {
}
}
// Option returns the success value as an Option.
//
// Deprecated: Use OkToSome instead.
func (r Result[T]) Option() Option[T] {
return r.Either.LeftToSome()
}
// OkToSome mutes the error value of the result.
func (r Result[T]) OkToSome() Option[T] {
return r.Either.LeftToSome()
}
// WhenResult executes the given function if the Result is a success.
//
// Deprecated: Use WhenOk instead.
func (r Result[T]) WhenResult(f func(T)) {
r.WhenLeft(f)
}
// WhenOk executes the given function if the Result is a success.
func (r Result[T]) WhenOk(f func(T)) {
r.WhenLeft(f)