newObject :: (MonadSTM m) => a -> m (Object a)
newObject x = liftSTM $ do
  n <- readTVar counter
  v <- newTVar x
  writeTVar counter $ n + 1
  pure $ Object { objectNumber = n, objectVar = v }
newObject :: (MonadSTM m) => a -> m (Object a)
newObject x = liftSTM $ do
  n <- readTVar counter
  v <- newTVar x
  writeTVar counter $ n + 1
  pure $ Object { objectNumber = n, objectVar = v }
newObject x = liftSTM $ do
  n <- readTVar counter
  v <- newTVar x
  writeTVar counter $ n + 1
  pure $ Object { objectNumber = n, objectVar = v }