Skip to content

Instantly share code, notes, and snippets.

@mheiber
Created October 15, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mheiber/9416ef06e2883f6bddfe1c5307fd9d29 to your computer and use it in GitHub Desktop.
Save mheiber/9416ef06e2883f6bddfe1c5307fd9d29 to your computer and use it in GitHub Desktop.
struct
type 'out t = < get : int -> 'out ; length : int >
let of_bytes v =
object
method length = bytes.length v
method get i = bytes.get v i
end
let of_array v =
object
method length = Array.length v
method get i = Array.get v i
end
let length t = t#length
let get t i = t#get i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment