You can encapsulate the `var`:

    val nextSeq = {
      var seqCounter: Long = 0L
      () => {
        val tmp = seqCounter
        seqCounter += 1
        SeqNo(tmp)
      }
    }