Interface Effect<A>

    • Method Detail

      • checkedApply

        IO<Unit> checkedApply​(A a)
                       throws java.lang.Throwable
        Description copied from interface: Fn1
        Invoke this function with the given argument, potentially throwing any Throwable.
        Specified by:
        checkedApply in interface Fn1<A,​IO<Unit>>
        Parameters:
        a - the argument
        Returns:
        the result of the function application
        Throws:
        java.lang.Throwable - anything possibly thrown by the function
      • toConsumer

        default java.util.function.Consumer<A> toConsumer()
        Convert this Effect to a java Consumer
        Returns:
        the Consumer
      • apply

        default IO<Unit> apply​(A a)
        Invoke this function explosively with the given argument.
        Specified by:
        apply in interface Fn1<A,​IO<Unit>>
        Parameters:
        a - the argument
        Returns:
        the result of the function application
      • diMapL

        default <Z> Effect<Z> diMapL​(Fn1<? super Z,​? extends A> fn)
        Contravariantly map over the argument to this function, producing a function that takes the new argument type, and produces the same result.
        Specified by:
        diMapL in interface Cartesian<A,​IO<Unit>,​Fn1<?,​?>>
        Specified by:
        diMapL in interface Cocartesian<A,​IO<Unit>,​Fn1<?,​?>>
        Specified by:
        diMapL in interface Fn1<A,​IO<Unit>>
        Specified by:
        diMapL in interface Profunctor<A,​IO<Unit>,​Fn1<?,​?>>
        Type Parameters:
        Z - the new argument type
        Parameters:
        fn - the contravariant argument mapping function
        Returns:
        an Fn1<Z, B>
      • fromConsumer

        static <A> Effect<A> fromConsumer​(java.util.function.Consumer<A> consumer)
        Static factory method to create an Effect from a java Consumer.
        Type Parameters:
        A - the input type
        Parameters:
        consumer - the Consumer
        Returns:
        the Effect
      • noop

        static <A> Effect<A> noop()
        Create an Effect that accepts an input and does nothing;
        Type Parameters:
        A - any desired input type
        Returns:
        the noop Effect
      • effect

        static <A> Effect<A> effect​(Fn1<? super A,​? extends IO<?>> fn)
        Create an Effect from an Fn1 that yields an IO.
        Type Parameters:
        A - the effect argument type
        Parameters:
        fn - the function
        Returns:
        the effect