package octez-proto-libs

  1. Overview
  2. Docs
Octez protocol libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-18.1.tar.gz
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a

doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V9/Make/Equality_witness/index.html

Module Make.Equality_witnessSource

This module provides support for type equalities and runtime type identifiers.

For two types a and b, (a, b) eq is a witness that a = b. This is a standard generalized algebraic datatype on top of which type-level programming techniques can be implemented.

Given a type a, an inhabitant of a t is a dynamic identifier for a. Identifiers can be compared for equality. They are also equipped with a hash function.

WARNING: the hash function changes at every run. Therefore, the result of the hash function should never be stored.

Notice that dynamic identifiers are not unique: two identifiers for a can have distinct hash and can be physically distinct. Hence, only eq can decide if two type identifiers correspond to the same type.

Sourcetype (_, _) eq =
  1. | Refl : ('a, 'a) eq

A proof witness that two types are equal.

Sourcetype 'a t

A dynamic representation for 'a.

Sourceval make : unit -> 'a t

make () is a dynamic representation for 'a. A fresh identifier is returned each time make () is evaluated.

Sourceval eq : 'a t -> 'b t -> ('a, 'b) eq option

eq ida idb returns a proof that a = b if ida and idb identify the same type.

Sourceval hash : 'a t -> int

hash id returns a hash for id.

OCaml

Innovation. Community. Security.