package catala

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module RuntimeSource

Types

Sourcetype money
Sourcetype integer
Sourcetype decimal
Sourcetype date
Sourcetype duration
Sourcetype source_position = {
  1. filename : string;
  2. start_line : int;
  3. start_column : int;
  4. end_line : int;
  5. end_column : int;
  6. law_headings : string list;
}
Sourcetype 'a eoption =
  1. | ENone of unit
  2. | ESome of 'a

Exceptions

Sourceexception EmptyError
Sourceexception AssertionFailed
Sourceexception ConflictError
Sourceexception UncomparableDurations
Sourceexception IndivisableDurations
Sourceexception ImpossibleDate
Sourceexception NoValueProvided of source_position

Value Embedding

Sourcetype runtime_value =
  1. | Unit
  2. | Bool of bool
  3. | Money of money
  4. | Integer of integer
  5. | Decimal of decimal
  6. | Date of date
  7. | Duration of duration
  8. | Enum of string list * string * runtime_value
  9. | Struct of string list * (string * runtime_value) list
  10. | Array of runtime_value Array.t
  11. | Unembeddable
Sourceval unembeddable : 'a -> runtime_value
Sourceval embed_unit : unit -> runtime_value
Sourceval embed_bool : bool -> runtime_value
Sourceval embed_money : money -> runtime_value
Sourceval embed_integer : integer -> runtime_value
Sourceval embed_decimal : decimal -> runtime_value
Sourceval embed_date : date -> runtime_value
Sourceval embed_duration : duration -> runtime_value
Sourceval embed_array : ('a -> runtime_value) -> 'a Array.t -> runtime_value

Logging

Sourcetype event =
  1. | BeginCall of string list
  2. | EndCall of string list
  3. | VariableDefinition of string list * runtime_value
  4. | DecisionTaken of source_position
Sourceval reset_log : unit -> unit
Sourceval retrieve_log : unit -> event list
Sourceval log_begin_call : string list -> ('a -> 'b) -> 'a -> 'b
Sourceval log_end_call : string list -> 'a -> 'a
Sourceval log_variable_definition : string list -> ('a -> runtime_value) -> 'a -> 'a
Sourceval log_decision_taken : source_position -> bool -> bool

Constructors and conversions

Money

Sourceval money_of_cents_string : string -> money
Sourceval money_of_units_int : int -> money
Sourceval money_of_cents_integer : integer -> money
Sourceval money_to_float : money -> float
Sourceval money_to_string : money -> string
Sourceval money_to_cents : money -> integer

Decimals

Sourceval decimal_of_string : string -> decimal
Sourceval decimal_to_string : max_prec_digits:int -> decimal -> string
Sourceval decimal_of_integer : integer -> decimal
Sourceval decimal_of_float : float -> decimal
Sourceval decimal_to_float : decimal -> float

Integers

Sourceval integer_of_string : string -> integer
Sourceval integer_to_string : integer -> string
Sourceval integer_to_int : integer -> int
Sourceval integer_of_int : int -> integer
Sourceval integer_log2 : integer -> int
Sourceval integer_exponentiation : integer -> int -> integer

Dates

Sourceval day_of_month_of_date : date -> integer
Sourceval month_number_of_date : date -> integer
Sourceval year_of_date : date -> integer
Sourceval date_to_string : date -> string
Sourceval date_of_numbers : int -> int -> int -> date

Usage: date_of_numbers year month day

Durations

Sourceval duration_of_numbers : int -> int -> int -> duration
Sourceval duration_to_years_months_days : duration -> int * int * int
Sourceval duration_to_string : duration -> string

Defaults

Sourceval handle_default : (unit -> 'a) array -> (unit -> bool) -> (unit -> 'a) -> 'a
Sourceval handle_default_opt : 'a eoption array -> bool eoption -> 'a eoption -> 'a eoption
Sourceval no_input : unit -> 'a

Operators

Money

Sourceval (*$) : money -> decimal -> money
Sourceval (/$) : money -> money -> decimal
Sourceval (+$) : money -> money -> money
Sourceval (-$) : money -> money -> money
Sourceval (~-$) : money -> money
Sourceval (=$) : money -> money -> bool
Sourceval (<=$) : money -> money -> bool
Sourceval (>=$) : money -> money -> bool
Sourceval (<$) : money -> money -> bool
Sourceval (>$) : money -> money -> bool

Integers

Sourceval (+!) : integer -> integer -> integer
Sourceval (-!) : integer -> integer -> integer
Sourceval (~-!) : integer -> integer
Sourceval (*!) : integer -> integer -> integer
Sourceval (=!) : integer -> integer -> bool
Sourceval (>=!) : integer -> integer -> bool
Sourceval (<=!) : integer -> integer -> bool
Sourceval (>!) : integer -> integer -> bool
Sourceval (<!) : integer -> integer -> bool

Decimals

Sourceval (+&) : decimal -> decimal -> decimal
Sourceval (-&) : decimal -> decimal -> decimal
Sourceval (~-&) : decimal -> decimal
Sourceval (*&) : decimal -> decimal -> decimal
Sourceval (=&) : decimal -> decimal -> bool
Sourceval (>=&) : decimal -> decimal -> bool
Sourceval (<=&) : decimal -> decimal -> bool
Sourceval (>&) : decimal -> decimal -> bool
Sourceval (<&) : decimal -> decimal -> bool

Dates

Sourceval (+@) : date -> duration -> date
Sourceval (-@) : date -> date -> duration
Sourceval (=@) : date -> date -> bool
Sourceval (>=@) : date -> date -> bool
Sourceval (<=@) : date -> date -> bool
Sourceval (>@) : date -> date -> bool
Sourceval (<@) : date -> date -> bool

Durations

Sourceval (~-^) : duration -> duration
Sourceval (=^) : duration -> duration -> bool
Sourceval (>=^) : duration -> duration -> bool
Sourceval (<=^) : duration -> duration -> bool
Sourceval (>^) : duration -> duration -> bool
Sourceval (<^) : duration -> duration -> bool

Arrays

Sourceval array_filter : ('a -> bool) -> 'a array -> 'a array
Sourceval array_length : 'a array -> integer
OCaml

Innovation. Community. Security.