union :: (PrimMonad m, R.MonadRef r m) => UFSet r m -> Int -> Int -> m Bool
union ufs u v = do
  u' <- find ufs u
  v' <- find ufs v
  if u' /= v'
    then do
      MV.unsafeWrite (ufsSet ufs) u' v' 
      R.modify_' (ufsSize ufs) pred
      return True
    else return False
union :: (PrimMonad m, R.MonadRef r m) => UFSet r m -> Int -> Int -> m Bool
union ufs u v = do
  u' <- find ufs u
  v' <- find ufs v
  if u' /= v'
    then do
      MV.unsafeWrite (ufsSet ufs) u' v' 
      R.modify_' (ufsSize ufs) pred
      return True
    else return False
union ufs u v = do
  u' <- find ufs u
  v' <- find ufs v
  if u' /= v'
    then do
      MV.unsafeWrite (ufsSet ufs) u' v' 
      R.modify_' (ufsSize ufs) pred
      return True
    else return False