Class EitherT<M extends MonadRec<?,​M>,​L,​R>

    • Method Detail

      • runEitherT

        public <MELR extends MonadRec<Either<L,​R>,​M>> MELR runEitherT()
        Recover the full structure of the embedded Monad.
        Type Parameters:
        MELR - the witnessed target type
        Returns:
        the embedded Monad
      • fmap

        public <R2> EitherT<M,​L,​R2> fmap​(Fn1<? super R,​? extends R2> fn)
        Covariantly transmute this functor's parameter using the given mapping function. Generally this method is specialized to return an instance of the class implementing Functor.
        Specified by:
        fmap in interface Applicative<M extends MonadRec<?,​M>,​L>
        Specified by:
        fmap in interface Functor<M extends MonadRec<?,​M>,​L>
        Specified by:
        fmap in interface Monad<M extends MonadRec<?,​M>,​L>
        Specified by:
        fmap in interface MonadError<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        fmap in interface MonadRec<M extends MonadRec<?,​M>,​L>
        Specified by:
        fmap in interface MonadT<M extends MonadRec<?,​M>,​R,​EitherT<M extends MonadRec<?,​M>,​L,​?>,​EitherT<?,​L,​?>>
        Type Parameters:
        R2 - the new parameter type
        Parameters:
        fn - the mapping function
        Returns:
        a functor over B (the new parameter type)
      • zip

        public <R2> EitherT<M,​L,​R2> zip​(Applicative<Fn1<? super R,​? extends R2>,​EitherT<M,​L,​?>> appFn)
        Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.
        Specified by:
        zip in interface Applicative<M extends MonadRec<?,​M>,​L>
        Specified by:
        zip in interface Monad<M extends MonadRec<?,​M>,​L>
        Specified by:
        zip in interface MonadError<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        zip in interface MonadRec<M extends MonadRec<?,​M>,​L>
        Specified by:
        zip in interface MonadT<M extends MonadRec<?,​M>,​R,​EitherT<M extends MonadRec<?,​M>,​L,​?>,​EitherT<?,​L,​?>>
        Type Parameters:
        R2 - the resulting applicative parameter type
        Parameters:
        appFn - the other applicative instance
        Returns:
        the mapped applicative
      • lazyZip

        public <R2> Lazy<EitherT<M,​L,​R2>> lazyZip​(Lazy<? extends Applicative<Fn1<? super R,​? extends R2>,​EitherT<M,​L,​?>>> lazyAppFn)
        Given a lazy instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports. This is useful for applicatives that support lazy evaluation and early termination.
        Specified by:
        lazyZip in interface Applicative<M extends MonadRec<?,​M>,​L>
        Specified by:
        lazyZip in interface Monad<M extends MonadRec<?,​M>,​L>
        Specified by:
        lazyZip in interface MonadError<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        lazyZip in interface MonadRec<M extends MonadRec<?,​M>,​L>
        Specified by:
        lazyZip in interface MonadT<M extends MonadRec<?,​M>,​R,​EitherT<M extends MonadRec<?,​M>,​L,​?>,​EitherT<?,​L,​?>>
        Type Parameters:
        R2 - the resulting applicative parameter type
        Parameters:
        lazyAppFn - the lazy other applicative instance
        Returns:
        the mapped applicative
        See Also:
        Maybe, Either
      • biMap

        public <L2,​R2> EitherT<M,​L2,​R2> biMap​(Fn1<? super L,​? extends L2> lFn,
                                                                Fn1<? super R,​? extends R2> rFn)
        Dually map covariantly over both the left and right parameters. This is isomorphic to biMapL(lFn).biMapR(rFn).
        Specified by:
        biMap in interface Bifunctor<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        biMap in interface BoundedBifunctor<L,​R,​java.lang.Object,​java.lang.Object,​EitherT<M extends MonadRec<?,​M>,​?,​?>>
        Type Parameters:
        L2 - the new left parameter type
        R2 - the new right parameter type
        Parameters:
        lFn - the left parameter mapping function
        rFn - the right parameter mapping function
        Returns:
        a bifunctor over C (the new left parameter type) and D (the new right parameter type)
      • biMapL

        public <L2> EitherT<M,​L2,​R> biMapL​(Fn1<? super L,​? extends L2> fn)
        Covariantly map over the left parameter.
        Specified by:
        biMapL in interface Bifunctor<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        biMapL in interface BoundedBifunctor<L,​R,​java.lang.Object,​java.lang.Object,​EitherT<M extends MonadRec<?,​M>,​?,​?>>
        Type Parameters:
        L2 - the new left parameter type
        Parameters:
        fn - the mapping function
        Returns:
        a bifunctor over C (the new left parameter) and B (the same right parameter)
      • biMapR

        public <R2> EitherT<M,​L,​R2> biMapR​(Fn1<? super R,​? extends R2> fn)
        Covariantly map over the right parameter. For all bifunctors that are also functors, it should hold that biMapR(f) == fmap(f).
        Specified by:
        biMapR in interface Bifunctor<M extends MonadRec<?,​M>,​L,​R>
        Specified by:
        biMapR in interface BoundedBifunctor<L,​R,​java.lang.Object,​java.lang.Object,​EitherT<M extends MonadRec<?,​M>,​?,​?>>
        Type Parameters:
        R2 - the new right parameter type
        Parameters:
        fn - the mapping function
        Returns:
        a bifunctor over A (the same left parameter) and C (the new right parameter)
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • eitherT

        public static <M extends MonadRec<?,​M>,​L,​R> EitherT<M,​L,​R> eitherT​(MonadRec<Either<L,​R>,​M> melr)
        Static factory method for lifting a Monad<Either<L, R>, M> into an EitherT.
        Type Parameters:
        M - the outer Monad unification parameter
        L - the left type
        R - the right type
        Parameters:
        melr - the Monad<Either<L, R>, M>
        Returns:
        the EitherT
      • pureEitherT

        public static <M extends MonadRec<?,​M>,​L> Pure<EitherT<M,​L,​?>> pureEitherT​(Pure<M> pureM)
        The canonical Pure instance for EitherT.
        Type Parameters:
        M - the argument Monad witness
        L - the left type
        Parameters:
        pureM - the argument Monad Pure
        Returns:
        the Pure instance