Error:
16 | Bytes.set_int8 out_bytes 0 (v.x );
^^^^^^^^^^^^^^
Error: Unbound value Bytes.set_int8
Code:
open! Core
module Pt3 = struct
type t =
{ x : int
; y : int
; z : int};;
let write (out_oc: Out_channel.t) (v: t) : unit =
let out_bytes = Bytes.create 8 in
let _ = v in
let _ = out_oc in
let _ = out_bytes in
Bytes.set_int8 out_bytes 0 (v.x );
Out_channel.output out_oc out_bytes 0 1;Out_channel.bytes out_oc out_bytes 0 1;Out_channel.bytes out_oc out_bytes 0 1; ();;
let read (in_ic: In_channel.t) (v: unit) : t =
let _ = v in
let _ = in_ic in
failwith "";;
end
set_int8 is documented at OCaml library : Bytes
val set_int8 : bytes -> int -> int -> unit
set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.
Context:
generating code that writes structs to bytearray