Nu am putut găsi această intrare. Se afișează rezultate aproximative. Verificați ortografia sau propuneți adăugarea acestui termen în dicționar.
State monad
Un uso de la monada State puede ser sumar los valores de un array de números sobre el estado actual.
One use of the State monad might be to add the values in an array of numbers to the current state.
Mientras que la monada State proporciona la capacidad de leer y escribir un único fragmento de estado mutable, la monada Reader solo proporciona la capacidad de leer un único fragmento de datos.
Whereas the State monad provides the ability to read and write a single piece of mutable state, the Reader monad only provides the ability to read a single piece of data.
O podemos querer el estado mutable proporcionado por la monada State junto a la capacidad pura de registrar errores de la monada Either.
Or we might want the mutable state provided by the State monad together with the pure error tracking capability of the Either monad.
Si definimos nuestro tipo Lazy con la monada State tenemos algo como
If we define our Lazy type with the State monad, we'll get something similar to
El transformador de monada WriterT se puede usar con la monada State para combinar los efectos que necesitamos.
The WriterT monad transformer can be used with the State monad to combine the effects we need.
Como en el caso de la monada State, execWriter solo devuelve el registro de mensajes acumulado, mientras que runWriter devuelve tanto el registro de mensajes como el resultado.
Just like in the case of the State monad, execWriter only returns the accumulated log, whereas runWriter returns both the log and the result.
Conținut posibil inadecvat
Exemplele au rolul de a te ajuta să traduci cuvinte sau expresii corect si adaptat la context. Nu sunt selectate sau validate manual, așadar pot conține termeni inadecvați. Te rugăm să raportezi exemplele pe care le consideri inadecvate. Traducerile vulgare sau colocviale sunt în general marcate cu roșu sau cu portocaliu.