sealed
trait
ZState[S] extends AnyRef
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 an effect that depends on some state, create the initial state with the
make
constructor and then usetoLayer
to convert it into a service builder that you can provide along with your application's other services.