Interface Fn2<A,B,C>

Type Parameters:
A - The first argument type
B - The second argument type
C - The return type
All Superinterfaces:
Applicative<Fn1<B,C>,Fn1<A,?>>, Cartesian<A,Fn1<B,C>,Fn1<?,?>>, Cocartesian<A,Fn1<B,C>,Fn1<?,?>>, Contravariant<A,Profunctor<?,Fn1<B,C>,Fn1<?,?>>>, Fn1<A,Fn1<B,C>>, Functor<Fn1<B,C>,Fn1<A,?>>, Monad<Fn1<B,C>,Fn1<A,?>>, MonadReader<A,Fn1<B,C>,Fn1<A,?>>, MonadRec<Fn1<B,C>,Fn1<A,?>>, MonadWriter<A,Fn1<B,C>,Fn1<A,?>>, Profunctor<A,Fn1<B,C>,Fn1<?,?>>
All Known Subinterfaces:
BiMonoidFactory<A,B,C>, BiPredicate<A,B>, BiSemigroupFactory<A,B,C>, Fn3<A,B,C,D>, Fn4<A,B,C,D,E>, Fn5<A,B,C,D,E,F>, Fn6<A,B,C,D,E,F,G>, Fn7<A,B,C,D,E,F,G,H>, Fn8<A,B,C,D,E,F,G,H,I>, Monoid<A>, MonoidFactory<A,B>, Semigroup<A>, SemigroupFactory<A,B>
All Known Implementing Classes:
$, Absent, AddAll, All, Alter, And, Any, AutoBracket, Between, Both, Bracket, CartesianProduct, Clamp, CmpEq, CmpEqBy, CmpEqWith, Collapse, Collapse, Compare, Compose, Compose, Concat, Cons, Constantly, Difference, Drop, DropWhile, Endo, EndoK, Eq, Filter, Find, First, FoldLeft, FoldRight, GroupBy, GT, GTBy, GTE, GTEBy, GTEWith, GTWith, IfThenElse, InGroupsOf, Intersection, Intersperse, Into, Into1, Into3, Into4, Into5, Into6, Into7, Into8, Iterate, Join, Last, LazyRec, LeftAll, LeftAll, LeftAny, LeftAny, LiftA2, LiftA3, LiftA4, LiftA5, LiftA6, LiftA7, LT, LTBy, LTE, LTEBy, LTEWith, LTWith, MagnetizeBy, Map, Matching, Max, MaxBy, MaxWith, Merge, Merge, MergeHMaps, MergeMaps, Min, MinBy, MinWith, Not, Or, Over, Partition, Peek, Peek2, PrependAll, Present, PutAll, RateLimit, ReduceLeft, ReduceRight, Replicate, RightAll, RightAll, RightAny, RightAny, RunAll, RunAll, ScanLeft, Sequence, Set, Slide, Snoc, SortBy, SortWith, Span, Take, TakeWhile, Times, ToArray, ToCollection, ToMap, Trampoline, Trivial, Tupler2, Under, Unfoldr, Union, Until, View, Xor, Zip, ZipWith
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Fn2<A,B,C> extends Fn1<A,Fn1<B,C>>
A function taking two arguments.

Note that defining Fn2 in terms of Fn1 provides a reasonable approximation of currying in the form of multiple apply(A, B) overloads that take different numbers of arguments.

See Also:
  • Method Details

    • checkedApply

      C checkedApply(A a, B b) throws Throwable
      Throws:
      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 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:
      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>
    • uncurry

      default Fn1<? super Product2<? extends A,? extends B>,C> uncurry()
      Returns an Fn1 that takes the arguments as a Product2<A, B>.
      Returns:
      an Fn1 taking a Product2
    • toBiFunction

      default BiFunction<A,B,C> toBiFunction()
      View this Fn2 as a BiFunction.
      Returns:
      the same logic as a BiFunction
      See Also:
    • 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>
    • contraMap

      default <Z> Fn2<Z,B,C> contraMap(Fn1<? super Z,? extends A> fn)
      Contravariantly map A <- B.
      Specified by:
      contraMap in interface Cartesian<A,B,C>
      Specified by:
      contraMap in interface Cocartesian<A,B,C>
      Specified by:
      contraMap in interface Contravariant<A,B>
      Specified by:
      contraMap in interface Fn1<A,B>
      Specified by:
      contraMap in interface Profunctor<A,B,C>
      Type Parameters:
      Z - the new parameter type
      Parameters:
      fn - the mapping function
      Returns:
      the mapped Contravariant functor instance
    • 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(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