Record Class Free.FlatMapped<F extends Kind<F,?>,A,B>

java.lang.Object
java.lang.Record
com.github.tonivade.purefun.free.Free.FlatMapped<F,A,B>
All Implemented Interfaces:
Bindable<Free<F,?>,B>, Mappable<Free<F,?>,B>, Free<F,B>, FreeOf<F,B>, Kind<Free<F,?>,B>
Enclosing interface:
Free<F extends Kind<F,?>,A>

public static record Free.FlatMapped<F extends Kind<F,?>,A,B>(Free<F extends Kind<F,?>,? extends A> value, Function1<? super A,? extends Kind<Free<F extends Kind<F,?>,?>,? extends B>> next) extends Record implements Free<F,B>
  • Field Details

    • value

      private final Free<F extends Kind<F,?>,? extends A> value
      The field for the value record component.
    • next

      private final Function1<? super A,? extends Kind<Free<F extends Kind<F,?>,?>,? extends B>> next
      The field for the next record component.
  • Constructor Details

    • FlatMapped

      public FlatMapped(Free<F,? extends A> value, Function1<? super A,? extends Kind<Free<F,?>,? extends B>> next)
      Creates an instance of a FlatMapped record class.
      Parameters:
      value - the value for the value record component
      next - the value for the next record component
  • Method Details

    • flatMap

      public <C> Free<F,C> flatMap(Function1<? super B,? extends Kind<Free<F,?>,? extends C>> map)
      Specified by:
      flatMap in interface Bindable<F extends Kind<F,?>,A>
      Specified by:
      flatMap in interface Free<F extends Kind<F,?>,A>
    • foldStep

      private <G extends Kind<G, ?>> Kind<G,Either<Free<F,B>,B>> foldStep(Monad<G> monad, FunctionK<F,G> interpreter)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public Free<F,? extends A> value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • next

      public Function1<? super A,? extends Kind<Free<F,?>,? extends B>> next()
      Returns the value of the next record component.
      Returns:
      the value of the next record component