modifyIORef< T> function
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> modifyIORef<T>(Endo<T> update, IORef<T> ref) => ref.modify(update);