package octez-proto-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V8/Make/Equality_witness/index.html
Module Make.Equality_witness
Source
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.
A dynamic representation for 'a
.
make ()
is a dynamic representation for 'a
. A fresh identifier is returned each time make ()
is evaluated.
eq ida idb
returns a proof that a = b
if ida
and idb
identify the same type.