I noticed that Data.UnionFind uses the IO monad to provide pointers via IORefs. I imagine everyone happily calls unsafePerformIO
when using it locally in pure code, since the data structure is so well understood, but ..
Is there a canonical cleaner approach to such data structures? Perhaps a wrapper around IO that makes the inevitable unsafePerformIO
less unsafe "looking" by prohibiting most IO operations?
unsafePerformIO
as possible. – Fossiliferous