Module type Parallel_arrays.Get

type 'a t

To read a value from a parallel array, we must prove that it does not escape its capsule. This is the case if its type crosses contention, or if it is manipulated within a portable function.

val get : 'a. 'a t -> Base.int -> 'a

get t i reads the element at index i. Raises Invalid_arg if i is not in the range [0..length t).

val unsafe_get : 'a. 'a t -> Base.int -> 'a

unsafe_get t i unsafely reads the element at index i.

val extract : 'a t -> Base.int -> ('a -> 'b @ portable contended) @ local once portable -> 'b @ portable contended

extract t i f applies f with the element read from index i. Raises Invalid_arg if i is not in the range [0..length t).

val unsafe_extract : 'a t -> Base.int -> ('a -> 'b @ portable contended) @ local once portable -> 'b @ portable contended

unsafe_extract t i f applies f with the element unsafely read from index i.