sealed
trait
ZState[S] extends AnyRef
Abstract Value Members
-
abstract
def
get(implicit trace: Trace): UIO[S]
-
abstract
def
set(s: S)(implicit trace: Trace): UIO[Unit]
-
abstract
def
update(f: (S) ⇒ S)(implicit trace: Trace): UIO[Unit]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
ZState[S]
models a value of typeS
that can be read from and written to during the execution of an effect. The idiomatic way to work withZState
is as part of the environment using operators defined onZIO
. For example:Because
ZState
is typically used as part of the environment, it is recommended to define your own state typeS
such asMyState
above rather than using a type such asInt
to avoid the risk of ambiguity.To run a stateful workflow, use the
ZIO.stateful
operator to allocate the initial state.