Example: Destructive List Insertion
data RList a = Nil | Cons a (IORef (RList a))
insertRList :: Ord a => a -> IORef (RList a) -> IO ()
Nil -> do new <- newIORef Nil
writeIORef xs (Cons x new)
| x<=y -> do new <- newIORef cell
writeIORef xs (Cons x new)
| x>y -> insertRList x xs'