Class LazyT<M extends MonadRec<?,​M>,​A>

    • Method Detail

      • runLazyT

        public <MLA extends MonadRec<Lazy<A>,​M>> MLA runLazyT()
        Recover the full structure of the embedded Monad.
        Type Parameters:
        MLA - the witnessed target type
        Returns:
        the embedded Monad
      • flatMap

        public <B> LazyT<M,​B> flatMap​(Fn1<? super A,​? extends Monad<B,​LazyT<M,​?>>> f)
        Chain dependent computations that may continue or short-circuit based on previous results.
        Specified by:
        flatMap in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        flatMap in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        flatMap in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the resulting monad parameter type
        Parameters:
        f - the dependent computation over A
        Returns:
        the new monad instance
      • pure

        public <B> LazyT<M,​B> pure​(B b)
        Lift the value b into this applicative functor.
        Specified by:
        pure in interface Applicative<M extends MonadRec<?,​M>,​A>
        Specified by:
        pure in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        pure in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        pure in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the type of the returned applicative's parameter
        Parameters:
        b - the value
        Returns:
        an instance of this applicative over b
      • fmap

        public <B> LazyT<M,​B> fmap​(Fn1<? super A,​? extends B> 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>,​A>
        Specified by:
        fmap in interface Functor<M extends MonadRec<?,​M>,​A>
        Specified by:
        fmap in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        fmap in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        fmap in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the new parameter type
        Parameters:
        fn - the mapping function
        Returns:
        a functor over B (the new parameter type)
      • zip

        public <B> LazyT<M,​B> zip​(Applicative<Fn1<? super A,​? extends B>,​LazyT<M,​?>> 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>,​A>
        Specified by:
        zip in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        zip in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        zip in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the resulting applicative parameter type
        Parameters:
        appFn - the other applicative instance
        Returns:
        the mapped applicative
      • lazyZip

        public <B> Lazy<LazyT<M,​B>> lazyZip​(Lazy<? extends Applicative<Fn1<? super A,​? extends B>,​LazyT<M,​?>>> 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>,​A>
        Specified by:
        lazyZip in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        lazyZip in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        lazyZip in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the resulting applicative parameter type
        Parameters:
        lazyAppFn - the lazy other applicative instance
        Returns:
        the mapped applicative
        See Also:
        Maybe, Either
      • discardL

        public <B> LazyT<M,​B> discardL​(Applicative<B,​LazyT<M,​?>> appB)
        Sequence both this Applicative and appB, discarding this Applicative's result and returning appB. This is generally useful for sequentially performing side-effects.
        Specified by:
        discardL in interface Applicative<M extends MonadRec<?,​M>,​A>
        Specified by:
        discardL in interface Monad<M extends MonadRec<?,​M>,​A>
        Specified by:
        discardL in interface MonadRec<M extends MonadRec<?,​M>,​A>
        Specified by:
        discardL in interface MonadT<M extends MonadRec<?,​M>,​A,​LazyT<M extends MonadRec<?,​M>,​?>,​LazyT<?,​?>>
        Type Parameters:
        B - the type of the returned Applicative's parameter
        Parameters:
        appB - the other Applicative
        Returns:
        appB
      • 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
      • lazyT

        public static <M extends MonadRec<?,​M>,​A> LazyT<M,​A> lazyT​(MonadRec<Lazy<A>,​M> mla)
        Static factory method for lifting a Monad<Lazy<A>, M> into a LazyT.
        Type Parameters:
        M - the outer Monad unification parameter
        A - the carrier type
        Parameters:
        mla - the Monad<Lazy<A>, M>
        Returns:
        the new LazyT
      • pureLazyT

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