package catala

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

Low-level handling of boxed expressions

This module contains helper functions for Bindlib, and wrappers to use boxed expressions.

We use the boxed_expr = naked_expr box marked type throughout, rather than the more straightforward expr box = naked_expr marked box, because the latter would force us to resolve the box every time we need to recover the annotation, which happens often. It's more efficient and convenient to add the annotation outside of the box, and delay its injection (using lift) to when the parent term gets built.

val lift : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed Bindlib.box

Inject the annotation within the box, to use e.g. when a gexpr box is required for building parent terms

val app0 : ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed

The app* functions allow building boxed expressions using Bindlib.apply_box and its variants, while correctly handling the expression annotations. Note that the function provided as argument should return a naked_gexpr and the expression annotation ('t) is provided as a separate argument.

val app1 : (('a, 'a, 'm1) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm1 Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ((('a, 'a, 'm1) Shared_ast__.Definitions.base_gexpr, 'm1 Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ('a, 'a, 'm2) Shared_ast__.Definitions.base_gexpr) -> 'm2 Shared_ast__.Definitions.mark -> (('a, 'a, 'm2) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm2 Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val app2 : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ((('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr) -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val app3 : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ((('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr) -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val appn : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ((('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr) -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val app1n : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ((('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr) -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val app2n : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ((('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed list -> ('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr) -> 'm Shared_ast__.Definitions.mark -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr Bindlib.box, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed
val fv : 'b Bindlib.box -> string list

fv return the list of free variables from a boxed term.

val assert_closed : 'b Bindlib.box -> unit

assert_closed b check there is no free variables in then b boxed term. It raises an internal error if it not the case, printing all free variables.

OCaml

Innovation. Community. Security.