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, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t 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, 't) Shared_ast__.Definitions.naked_gexpr -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t

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, 't1) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't1) Catala_utils.Marked.t -> ((('a, 't1) Shared_ast__.Definitions.naked_gexpr, 't1) Catala_utils.Marked.t -> ('a, 't2) Shared_ast__.Definitions.naked_gexpr) -> 't2 -> (('a, 't2) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't2) Catala_utils.Marked.t
val app2 : (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> ((('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> ('a, 't) Shared_ast__.Definitions.naked_gexpr) -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t
val app3 : (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> ((('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> ('a, 't) Shared_ast__.Definitions.naked_gexpr) -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t
val appn : (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t list -> ((('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t list -> ('a, 't) Shared_ast__.Definitions.naked_gexpr) -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t
val app1n : (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t list -> ((('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t list -> ('a, 't) Shared_ast__.Definitions.naked_gexpr) -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t
val app2n : (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t list -> ((('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t -> (('a, 't) Shared_ast__.Definitions.naked_gexpr, 't) Catala_utils.Marked.t list -> ('a, 't) Shared_ast__.Definitions.naked_gexpr) -> 't -> (('a, 't) Shared_ast__.Definitions.naked_gexpr Bindlib.box, 't) Catala_utils.Marked.t
OCaml

Innovation. Community. Security.