modify method
Works almost identical to the write method, but instead of taking a value that needs to be written, takes an Endo function, applies the IORef's current value to it and writes the result to the IORef.
Implementation
IO<Unit> modify(Endo<T> update) => read().map(update).flatMap(write);