The internal implementation of Data.Unique uses IORef as the counter that stores the next unique integer.
From what I know, IORefs are not entirely thread-safe. Especially, in this case, we need to atomically take the data out and add one to it. If it is not atomic we may end up with two same numbers being read before the counter is updated.
I am aware that the implementation of newUnique uses atomicModifyIORef, which is said to be atomic only when one IORef is used in the whole program.
Therefore I can infer that Unique would be thread safe if I do not use any IORefs in my program. The question is: what may happen when I use another IORef? How will the behavior be problematic? Or it will become problematic only if I attempt to use atomicModifyIORef on other IORefs?