Package com.jnape.palatable.lambda.adt
Class Try.Failure<A>
- java.lang.Object
-
- com.jnape.palatable.lambda.adt.Try<A>
-
- com.jnape.palatable.lambda.adt.Try.Failure<A>
-
- All Implemented Interfaces:
CoProduct2<java.lang.Throwable,A,Try<A>>
,Applicative<A,Try<?>>
,Functor<A,Try<?>>
,Monad<A,Try<?>>
,MonadError<java.lang.Throwable,A,Try<?>>
,MonadRec<A,Try<?>>
,Traversable<A,Try<?>>
private static final class Try.Failure<A> extends Try<A>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwable
t
-
Constructor Summary
Constructors Modifier Constructor Description private
Failure(java.lang.Throwable t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
int
hashCode()
<R> R
match(Fn1<? super java.lang.Throwable,? extends R> aFn, Fn1<? super A,? extends R> bFn)
Type-safe convergence requiring a match against all potential types.<T extends java.lang.Throwable>
AorThrow(Fn1<? super java.lang.Throwable,? extends T> fn)
If this is a success value, return it.java.lang.String
toString()
-
Methods inherited from class com.jnape.palatable.lambda.adt.Try
catchError, catching, catching, discardL, discardR, ensuring, failure, flatMap, fmap, forfeit, lazyZip, orThrow, pure, pureTry, recover, success, throwError, toEither, toEither, toMaybe, trampolineM, traverse, trying, trying, withResources, withResources, withResources, zip
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
orThrow
public <T extends java.lang.Throwable> A orThrow(Fn1<? super java.lang.Throwable,? extends T> fn) throws T extends java.lang.Throwable
Description copied from class:Try
If this is a success value, return it. Otherwise, transform the captured failure withfn
and throw the result.
-
match
public <R> R match(Fn1<? super java.lang.Throwable,? extends R> aFn, Fn1<? super A,? extends R> bFn)
Description copied from interface:CoProduct2
Type-safe convergence requiring a match against all potential types.- Type Parameters:
R
- result type- Parameters:
aFn
- morphismA -> R
bFn
- morphismB -> R
- Returns:
- the result of applying the appropriate morphism to this coproduct's unwrapped value
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-