Transforms using implicitly available evidence that such a transformation is possible.
Transforms using implicitly available evidence that such a transformation is possible.
Typical transformations include converting:
F[L]
for some L <: HList
to/from an F[CC]
for some case class CC
, where the types in the case class are
aligned with the types in L
F[C]
for some C <: Coproduct
to/from an F[SC]
for some sealed class SC
, where the component types in
the coproduct are the leaf subtypes of the sealed class.Transforms using two functions, A => Attempt[B]
and B => Attempt[A]
.
Transforms using two functions, A => Attempt[B]
and B => Attempt[A]
.
Curried version of exmap
.
Curried version of exmap
.
Maps the supplied function over the successful value, if present.
Maps the supplied function over the successful value, if present.
Converts an Attempt[Attempt[X]]
in to an Attempt[X]
.
Converts an Attempt[Attempt[X]]
in to an Attempt[X]
.
Transforms this attempt to a value of type B
using the supplied functions.
Transforms this attempt to a value of type B
using the supplied functions.
Returns the sucessful value if successful, otherwise the supplied default.
Returns the sucessful value if successful, otherwise the supplied default.
True if attempt was not successful.
True if attempt was not successful.
True if attempt was successful.
True if attempt was successful.
Maps the supplied function over the successful value, if present.
Maps the supplied function over the successful value, if present.
Maps the supplied function over the failure error, if present.
Maps the supplied function over the failure error, if present.
Transforms using two functions, A => Attempt[B]
and B => A
.
Transforms using two functions, A => Attempt[B]
and B => A
.
The supplied functions form an injection from B
to A
. Hence, this method converts from
a larger to a smaller type. Hence, the name narrow
.
Curried version of narrow
.
Curried version of narrow
.
Returns this attempt if successful, otherwise the fallback attempt.
Returns this attempt if successful, otherwise the fallback attempt.
If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned.
If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.
If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned.
If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.
Returns the successful value if present; otherwise throws an IllegalArgumentException
.
Returns the successful value if present; otherwise throws an IllegalArgumentException
.
Supports TransformSyntax.
Supports TransformSyntax.
Converts to an either.
Converts to an either.
Converts to an option, discarding the error value.
Converts to an option, discarding the error value.
Transforms using two functions, A => B
and B => Attempt[A]
.
Transforms using two functions, A => B
and B => Attempt[A]
.
The supplied functions form an injection from A
to B
. Hence, this method converts from
a smaller to a larger type. Hence, the name widen
.
Transforms using two functions, A => B
and B => Option[A]
.
Transforms using two functions, A => B
and B => Option[A]
.
Particularly useful when combined with case class apply/unapply. E.g., widenOpt(fa, Foo.apply, Foo.unapply)
.
Curried version of widenOpt
.
Curried version of widenOpt
.
Curried version of widen
.
Curried version of widen
.
Transforms using the isomorphism described by two functions, A => B
and B => A
.
Transforms using the isomorphism described by two functions, A => B
and B => A
.
Curried version of xmap
.
Curried version of xmap
.
Transforms using two functions, A => B
and B => Option[A]
.
Transforms using two functions, A => B
and B => Option[A]
.
Particularly useful when combined with case class apply/unapply. E.g., pxmap(fa, Foo.apply, Foo.unapply)
.
(Since version 1.7.0) Use widenOpt instead
Successful attempt.