Class Ref<A>

java.lang.Object
com.github.tonivade.purefun.monad.Ref<A>

public final class Ref<A> extends Object
  • Field Details

  • Constructor Details

    • Ref

      private Ref(A value)
  • Method Details

    • get

      public IO<A> get()
    • set

      public IO<Unit> set(A newValue)
    • modify

      public <B> IO<B> modify(Function1<A,Tuple2<B,A>> change)
    • lazySet

      public IO<Unit> lazySet(A newValue)
    • getAndSet

      public IO<A> getAndSet(A newValue)
    • updateAndGet

      public IO<A> updateAndGet(Operator1<A> update)
    • getAndUpdate

      public IO<A> getAndUpdate(Operator1<A> update)
    • make

      public static <A> IO<Ref<A>> make(A value)
    • of

      public static <A> Ref<A> of(A value)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • safeGet

      private A safeGet()