Interface Fn2<A,​B,​C>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default Fn1<B,​C> apply​(A a)
      Partially apply this function by passing its first argument.
      default C apply​(A a, B b)
      Invoke this function with the given arguments.
      default Fn1<B,​C> checkedApply​(A a)
      Invoke this function with the given argument, potentially throwing any Throwable.
      C checkedApply​(A a, B b)  
      default <Y,​Z>
      Fn3<Y,​Z,​B,​C>
      compose​(Fn2<? super Y,​? super Z,​? extends A> before)
      Right-to-left composition between different arity functions.
      default <Z> Fn2<Z,​B,​C> contraMap​(Fn1<? super Z,​? extends A> fn)
      Contravariantly map A <- B.
      static <A,​B,​C>
      Fn2<A,​B,​C>
      curried​(Fn1<A,​Fn1<B,​C>> curriedFn1)
      Static factory method for wrapping a curried Fn1 in an Fn2.
      static <A,​B,​C>
      Fn2<A,​B,​C>
      curry​(Fn1<? super Tuple2<A,​B>,​? extends C> uncurriedFn1)
      Static factory method for wrapping an uncurried Fn1 in an Fn2.
      default <Z> Fn2<Z,​B,​C> 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.
      default <D> Fn2<A,​B,​C> discardR​(Applicative<D,​Fn1<A,​?>> appB)
      Sequence both this Applicative and appB, discarding appB's result and returning this Applicative.
      default Fn2<B,​A,​C> flip()
      Flip the order of the arguments.
      static <A,​B,​C>
      Fn2<A,​B,​C>
      fn2​(Fn2<A,​B,​C> fn2)
      Static method to aid inference.
      static <A,​B,​C>
      Fn2<A,​B,​C>
      fromBiFunction​(java.util.function.BiFunction<? super A,​? super B,​? extends C> biFunction)
      Static factory method for wrapping a BiFunction in an Fn2.
      default java.util.function.BiFunction<A,​B,​C> toBiFunction()
      View this Fn2 as a BiFunction.
      default Fn1<? super Product2<? extends A,​? extends B>,​C> uncurry()
      Returns an Fn1 that takes the arguments as a Product2<A, B>.
      default <Z> Fn3<Z,​A,​B,​C> widen()
      Widen this function's argument list by prepending an ignored argument of any type to the front.
      • Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

        coerce
    • Method Detail

      • checkedApply

        C checkedApply​(A a,
                       B b)
                throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • apply

        default C apply​(A a,
                        B b)
        Invoke this function with the given arguments.
        Parameters:
        a - the first argument
        b - the second argument
        Returns:
        the result of the function application
      • checkedApply

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

        default <Z> Fn3<Z,​A,​B,​C> widen()
        Widen this function's argument list by prepending an ignored argument of any type to the front.
        Specified by:
        widen in interface Fn1<A,​B>
        Type Parameters:
        Z - the new first argument type
        Returns:
        the widened function
      • apply

        default Fn1<B,​C> apply​(A a)
        Partially apply this function by passing its first argument.
        Specified by:
        apply in interface Fn1<A,​B>
        Parameters:
        a - the first argument
        Returns:
        an Fn1<B, C>
      • flip

        default Fn2<B,​A,​C> flip()
        Flip the order of the arguments.
        Returns:
        an Fn2<B, A, C>
      • toBiFunction

        default java.util.function.BiFunction<A,​B,​C> toBiFunction()
        View this Fn2 as a BiFunction.
        Returns:
        the same logic as a BiFunction
        See Also:
        BiFunction
      • discardR

        default <D> Fn2<A,​B,​C> discardR​(Applicative<D,​Fn1<A,​?>> appB)
        Sequence both this Applicative and appB, discarding appB's result and returning this Applicative. This is generally useful for sequentially performing side-effects.
        Specified by:
        discardR in interface Applicative<A,​B>
        Specified by:
        discardR in interface Fn1<A,​B>
        Specified by:
        discardR in interface Monad<A,​B>
        Specified by:
        discardR in interface MonadReader<A,​B,​C>
        Specified by:
        discardR in interface MonadRec<A,​B>
        Specified by:
        discardR in interface MonadWriter<A,​B,​C>
        Type Parameters:
        D - the type of appB's parameter
        Parameters:
        appB - the other Applicative
        Returns:
        this Applicative
      • diMapL

        default <Z> Fn2<Z,​B,​C> 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,​B,​C>
        Specified by:
        diMapL in interface Cocartesian<A,​B,​C>
        Specified by:
        diMapL in interface Fn1<A,​B>
        Specified by:
        diMapL in interface Profunctor<A,​B,​C>
        Type Parameters:
        Z - the new argument type
        Parameters:
        fn - the contravariant argument mapping function
        Returns:
        an Fn1<Z, B>
      • compose

        default <Y,​Z> Fn3<Y,​Z,​B,​C> compose​(Fn2<? super Y,​? super Z,​? extends A> before)
        Right-to-left composition between different arity functions. Preserves highest arity in the return type.
        Specified by:
        compose in interface Fn1<A,​B>
        Type Parameters:
        Y - the resulting function's first argument type
        Z - the resulting function's second argument type
        Parameters:
        before - the function to pass its return value to this function's input
        Returns:
        an Fn2<Y, Z, B>
      • fromBiFunction

        static <A,​B,​C> Fn2<A,​B,​C> fromBiFunction​(java.util.function.BiFunction<? super A,​? super B,​? extends C> biFunction)
        Static factory method for wrapping a BiFunction in an Fn2.
        Type Parameters:
        A - the first input argument type
        B - the second input argument type
        C - the output type
        Parameters:
        biFunction - the biFunction to adapt
        Returns:
        the Fn2
      • curried

        static <A,​B,​C> Fn2<A,​B,​C> curried​(Fn1<A,​Fn1<B,​C>> curriedFn1)
        Static factory method for wrapping a curried Fn1 in an Fn2.
        Type Parameters:
        A - the first input argument type
        B - the second input argument type
        C - the output type
        Parameters:
        curriedFn1 - the curried fn1 to adapt
        Returns:
        the Fn2
      • curry

        static <A,​B,​C> Fn2<A,​B,​C> curry​(Fn1<? super Tuple2<A,​B>,​? extends C> uncurriedFn1)
        Static factory method for wrapping an uncurried Fn1 in an Fn2.
        Type Parameters:
        A - the first input argument type
        B - the second input argument type
        C - the output type
        Parameters:
        uncurriedFn1 - the uncurried Fn1 to adapt
        Returns:
        the Fn2
      • fn2

        static <A,​B,​C> Fn2<A,​B,​C> fn2​(Fn2<A,​B,​C> fn2)
        Static method to aid inference.
        Type Parameters:
        A - the first input type
        B - the second input type
        C - the output type
        Parameters:
        fn2 - the Fn2
        Returns:
        the Fn2