A collection of examples of how to solve particular problems with Eff
It’s common to want to use different effects in different parts of a program. Some effects, like error handling or logging, may extend through the whole of our program. However we may want to include additional effects, like state, within one part.
The example below shows how we can do this
the incrementNTimes methods uses an additional
State effect for its implementation (necessary to call
incrementCounter)
the additional State effect is added to
R with the prepend method:
Fx.prepend[StateInt, R]
runState is called within
incrementNTimes to finally interpret that effect
`> Right((6,List(counter == 4, counter == 5, counter
== 6)))`