(module raw_buf_int
  (fn main
    (doc "raw-buf.4 worked consumer: fill a 3-slot Int RawBuf with 10/20/30 and print their sum (60). Exercises RawBuf.new/.set/.get @ Int end-to-end.")
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (app print
        (let buf (new RawBuf (con Int) 3)
          (let buf (app RawBuf.set buf 0 10)
            (let buf (app RawBuf.set buf 1 20)
              (let buf (app RawBuf.set buf 2 30)
                (app + (app RawBuf.get buf 0)
                  (app + (app RawBuf.get buf 1)
                    (app RawBuf.get buf 2)))))))))))
