package catala

  1. Overview
  2. Docs
Compiler and library for the literate programming language for tax code specification

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.0.0-beta.tar.gz
md5=c41cbc1fa003e167bbc0bb1cd7723ab3
sha512=1e07951e2d73040bc0bea89f04bcb50c3a533323a7c7d8bac9ee9aa6be5233f795a32857421d04f17e52a841057cdc78b33f79fa239a17dd12de97a738c81999

doc/catala.catala_utils/Catala_utils/Hash/index.html

Module Catala_utils.HashSource

Hashes for the identification of modules.

In contrast with OCaml's basic `Hashtbl.hash`, they process the full depth of terms. Any meaningful interface change in a module should only be in hash collision with a 1/2^30 probability.

Sourcetype t = private int

Native Hasthbl.hash hashes, value is truncated to 30 bits whatever the architecture (positive 31-bit integers)

Sourcetype full

A "full" hash includes the Catala version and compilation flags, alongside the module interface

Sourceval raw : 'a -> t

Hashtbl.hash. Do not use on deep types (it has a bounded depth), use specific hashing functions.

Sourcemodule Op : sig ... end
Sourceval option : ('a -> t) -> 'a option -> t
Sourceval list : ('a -> t) -> 'a list -> t
Sourceval map : (('k -> 'v -> t -> t) -> 'map -> t -> t) -> ('k -> t) -> ('v -> t) -> 'map -> t

map fold_f key_hash_f value_hash_f map computes the hash of a map. The first argument is expected to be a Foo.Map.fold function. The result is independent of the ordering of the map.

Sourceval finalise : t -> monomorphize_types:bool -> full

Turns a raw interface hash into a full hash, ready for printing

Sourceval to_string : full -> string
Sourceval format : Format.formatter -> full -> unit
Sourceval of_string : string -> full

Raises Failure

Sourceval external_placeholder : string

It's inconvenient to need hash updates on external modules. This string is uses as a hash instead for those cases.

NOTE: This is a temporary solution A future approach could be to have Catala generate a module loader (with the proper hash), relieving the user implementation from having to do the registration.