let next (counter: counter) : int =
  inc counter;
  value counter