gleamunison/identity

Types

A content-addressed reference to a definition.

pub type DefinitionRef {
  Ref(hash: Hash)
}

Constructors

Opaque hash type. No access to the inner bytes outside this module.

pub opaque type Hash

Local variable binding using de Bruijn indices.

pub type LocalVar {
  Local(index: Int)
}

Constructors

  • Local(index: Int)

Values

pub fn hash_bytes(contents: BitArray) -> Hash

Compute a SHA-256 hash from arbitrary bytes.

pub fn hash_equal(a: Hash, b: Hash) -> Bool

Compare two hashes for equality.

pub fn hash_from_bytes(contents: BitArray) -> Hash
pub fn hash_to_bytes(h: Hash) -> BitArray
pub fn hash_to_debug_string(h: Hash) -> String

Produce a hex string for display/debugging.

pub fn hash_to_short_string(h: Hash) -> String

Produce a short hash prefix for display.

pub fn hex_to_bytes(hex: String) -> BitArray
pub fn local_var_index(lv: LocalVar) -> Int

Extract the index from a LocalVar (de Bruijn index).

Search Document