package phantom-algebra

  1. Overview
  2. Docs

Cloning a value is useful to duplicate the type-level information associated to this value when this value is provided as an function argument. This useful when using multiple time this value with functions performing different type-level computations.

type (+'dim, +'rank) t
val clone_2 : ([< `one of ('dim1 * 'dim2) as 't & _ Type_functions.one * _ Type_functions.one | `two of 't & _ Type_functions.two * _ Type_functions.two | `three of 't & _ Type_functions.three * _ Type_functions.three | `four of 't & _ Type_functions.four * _ Type_functions.four ], [< `zero of ('rank1 * 'rank2) as 'r & _ Type_functions.z * _ Type_functions.z | `one of 'r & _ Type_functions.one * _ Type_functions.one | `two of 'r & _ Type_functions.two * _ Type_functions.two ]) t -> ('dim1, 'rank1) t * ('dim2, 'rank2) t

clone_2 v returns two clones x,y of the value v with the same types as the original type of  v

val clone_3 : ([< `one of ('dim1 * 'dim2 * 'dim3) as 't & _ Type_functions.one * _ Type_functions.one * _ Type_functions.one | `two of 't & _ Type_functions.two * _ Type_functions.two * _ Type_functions.two | `three of 't & _ Type_functions.three * _ Type_functions.three * _ Type_functions.three | `four of 't & _ Type_functions.four * _ Type_functions.four * _ Type_functions.four ], [< `zero of ('rank1 * 'rank2 * 'rank3) as 'r & _ Type_functions.z * _ Type_functions.z * _ Type_functions.z | `one of 'r & _ Type_functions.one * _ Type_functions.one * _ Type_functions.one | `two of 'r & _ Type_functions.two * _ Type_functions.two * _ Type_functions.two ]) t -> ('dim1, 'rank1) t * ('dim2, 'rank2) t * ('dim3, 'rank3) t

clone_k are not strictly required, but they are here to avoid the pattern

let a, t = clone_2 t in
let b, t = clone_2 t in
…

required by the sole use of clone_2

val clone_7 : ([< `one of ('dim1 * 'dim2 * 'dim3 * 'dim4 * 'dim5 * 'dim6 * 'dim7) as 'd & _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one | `two of 'd & _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two | `three of 'd & _ Type_functions.three * _ Type_functions.three * _ Type_functions.three * _ Type_functions.three * _ Type_functions.three * _ Type_functions.three * _ Type_functions.three | `four of 'd & _ Type_functions.four * _ Type_functions.four * _ Type_functions.four * _ Type_functions.four * _ Type_functions.four * _ Type_functions.four * _ Type_functions.four ], [< `zero of ('rank1 * 'rank2 * 'rank3 * 'rank4 * 'rank5 * 'rank6 * 'rank7) as 'r & _ Type_functions.z * _ Type_functions.z * _ Type_functions.z * _ Type_functions.z * _ Type_functions.z * _ Type_functions.z * _ Type_functions.z | `one of 'r & _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one * _ Type_functions.one | `two of 'r & _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two * _ Type_functions.two ]) t -> ('dim1, 'rank1) t * ('dim2, 'rank2) t * ('dim3, 'rank3) t * ('dim4, 'rank4) t * ('dim5, 'rank5) t * ('dim6, 'rank6) t * ('dim7, 'rank7) t
OCaml

Innovation. Community. Security.