Implement an additional localised, user-facing value printer

This commit is contained in:
Louis Gesbert 2023-07-03 16:14:22 +02:00
parent c799968934
commit 89e90271c1
47 changed files with 437 additions and 299 deletions

View File

@ -26,7 +26,8 @@ let modname_of_file f =
(* Fixme: make this more robust *) (* Fixme: make this more robust *)
String.capitalize_ascii Filename.(basename (remove_extension f)) String.capitalize_ascii Filename.(basename (remove_extension f))
let get_lang options filename = let get_lang options file =
let filename = match file with Cli.FileName s -> s | Contents _ -> "-" in
Option.bind Option.bind
(List.assoc_opt (Filename.extension filename) extensions) (List.assoc_opt (Filename.extension filename) extensions)
(fun l -> List.assoc_opt l Cli.languages) (fun l -> List.assoc_opt l Cli.languages)
@ -44,7 +45,7 @@ let get_lang options filename =
let load_module_interfaces prg options link_modules = let load_module_interfaces prg options link_modules =
List.fold_left List.fold_left
(fun prg f -> (fun prg f ->
let lang = get_lang options f in let lang = get_lang options (FileName f) in
let modname = modname_of_file f in let modname = modname_of_file f in
Surface.Parser_driver.add_interface (FileName f) lang [modname] prg) Surface.Parser_driver.add_interface (FileName f) lang [modname] prg)
prg link_modules prg link_modules
@ -55,10 +56,7 @@ module Passes = struct
let surface options : Surface.Ast.program * Cli.backend_lang = let surface options : Surface.Ast.program * Cli.backend_lang =
Message.emit_debug "Reading files..."; Message.emit_debug "Reading files...";
let language = let language = get_lang options options.input_file in
get_lang options
(match options.input_file with FileName s -> s | Contents _ -> "")
in
let prg = let prg =
Surface.Parser_driver.parse_top_level_file options.input_file language Surface.Parser_driver.parse_top_level_file options.input_file language
in in
@ -555,7 +553,7 @@ module Commands = struct
List.iter List.iter
(fun ((var, _), result) -> (fun ((var, _), result) ->
Message.emit_result "@[<hov 2>%s@ =@ %a@]" var Message.emit_result "@[<hov 2>%s@ =@ %a@]" var
(Print.expr ~debug:options.Cli.debug ()) (Print.UserFacing.value (get_lang options options.input_file))
result) result)
results results

View File

@ -873,3 +873,167 @@ let rec code_item_list ?(debug = false) decl_ctx fmt c =
let program ?(debug = false) fmt p = let program ?(debug = false) fmt p =
decl_ctx ~debug p.decl_ctx fmt p.decl_ctx; decl_ctx ~debug p.decl_ctx fmt p.decl_ctx;
code_item_list ~debug p.decl_ctx fmt p.code_items code_item_list ~debug p.decl_ctx fmt p.code_items
(* - User-facing value printer - *)
module UserFacing = struct
(* Refs:
https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Dates_and_numbers#Grouping_of_digits
https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Conventions_concernant_les_nombres#Pour_un_comptage_ou_une_mesure *)
let bigsep (lang : Cli.backend_lang) =
match lang with En -> ",", 3 | Fr -> " ", 3 | Pl -> ",", 3
let decsep (lang : Cli.backend_lang) =
match lang with En -> "." | Fr -> "," | Pl -> "."
let unit (_lang : Cli.backend_lang) ppf () = Format.pp_print_string ppf "()"
let bool (lang : Cli.backend_lang) ppf b =
let s =
match lang, b with
| En, true -> "true"
| En, false -> "false"
| Fr, true -> "vrai"
| Fr, false -> "faux"
| Pl, true -> "prawda"
| Pl, false -> "falsz"
in
Format.pp_print_string ppf s
let integer (lang : Cli.backend_lang) ppf n =
let sep, nsep = bigsep lang in
let nsep = Z.pow (Z.of_int 10) nsep in
if Z.sign n < 0 then Format.pp_print_char ppf '-';
let rec aux n =
let a, b = Z.div_rem n nsep in
if Z.equal a Z.zero then Z.pp_print ppf b
else (
aux a;
Format.fprintf ppf "%s%03d" sep (Z.to_int b))
in
aux (Z.abs n)
let money (lang : Cli.backend_lang) ppf n =
(match lang with En -> Format.pp_print_string ppf "$" | Fr | Pl -> ());
let units, cents = Z.div_rem n (Z.of_int 100) in
integer lang ppf units;
Format.pp_print_string ppf (decsep lang);
Format.fprintf ppf "%02d" (Z.to_int (Z.abs cents));
match lang with
| En -> ()
| Fr -> Format.pp_print_string ppf ""
| Pl -> Format.pp_print_string ppf " PLN"
let decimal (lang : Cli.backend_lang) ppf r =
let den = Q.den r in
let int_part, rem = Z.div_rem (Q.num r) den in
let rem = Z.abs rem in
(* Printing the integer part *)
integer lang ppf int_part;
(* Printing the decimals *)
let bigsep, nsep = bigsep lang in
let rec aux ndigit rem_digits rem =
let n, rem = Z.div_rem (Z.mul rem (Z.of_int 10)) den in
let rem_digits, stop =
match rem_digits with
| None ->
if Z.equal n Z.zero then None, false
else
let r = Cli.globals.max_prec_digits in
Some (r - 1), r <= 1
| Some r -> Some (r - 1), r <= 1
in
if ndigit mod nsep = 0 then
Format.pp_print_string ppf (if ndigit = 0 then decsep lang else bigsep);
Format.pp_print_int ppf (Z.to_int n);
if Z.gt rem Z.zero then
if stop then Format.pp_print_as ppf 1 ""
else aux (ndigit + 1) rem_digits rem
in
let rec ndigits n =
if Z.equal n Z.zero then 0 else 1 + ndigits (Z.div n (Z.of_int 10))
in
aux 0
(if Z.equal int_part Z.zero then None else Some (Cli.globals.max_prec_digits - ndigits int_part))
rem
(* It would be nice to print ratios as % but that's impossible to guess.
Trying would lead to inconsistencies where some comparable numbers are in %
and some others not, adding confusion. *)
let date (lang : Cli.backend_lang) ppf d =
let y, m, d = Dates_calc.Dates.date_to_ymd d in
match lang with
| En | Pl -> Format.fprintf ppf "%04d-%02d-%02d" y m d
| Fr -> Format.fprintf ppf "%02d/%02d/%04d" d m y
let duration (lang : Cli.backend_lang) ppf dr =
let y, m, d = Dates_calc.Dates.period_to_ymds dr in
let rec filter0 = function
| (0, _) :: (_ :: _ as r) -> filter0 r
| x :: r -> x :: List.filter (fun (n, _) -> n <> 0) r
| [] -> []
in
let splur n s = if abs n > 1 then n, s ^ "s" else n, s in
Format.pp_print_char ppf '[';
(match lang with
| En -> [splur y "year"; splur m "month"; splur d "day"]
| Fr -> [splur y "an"; m, "mois"; splur d "jour"]
| Pl -> [y, "rok"; m, "miesiac"; d, "dzien"])
|> filter0
|> Format.pp_print_list
~pp_sep:(fun ppf () -> Format.pp_print_string ppf ", ")
(fun ppf (n, s) -> Format.fprintf ppf "%d %s" n s)
ppf;
Format.pp_print_char ppf ']'
let lit_raw (lang : Cli.backend_lang) ppf lit : unit =
match lit with
| LUnit -> unit lang ppf ()
| LBool b -> bool lang ppf b
| LInt i -> integer lang ppf i
| LRat r -> decimal lang ppf r
| LMoney e -> money lang ppf e
| LDate d -> date lang ppf d
| LDuration dr -> duration lang ppf dr
let lit_to_string (lang : Cli.backend_lang) lit =
let buf = Buffer.create 32 in
let ppf = Format.formatter_of_buffer buf in
lit_raw lang ppf lit;
Format.pp_print_flush ppf ();
Buffer.contents buf
let lit (lang : Cli.backend_lang) ppf lit : unit =
with_color (lit_raw lang) Ocolor_types.yellow ppf lit
let rec value :
type a b.
Cli.backend_lang ->
Format.formatter ->
((a, b) dcalc_lcalc, _) gexpr ->
unit =
fun lang ppf e ->
match Mark.remove e with
| ELit l -> lit lang ppf l
| EArray l | ETuple l ->
Format.fprintf ppf "@[<hov 1>[@;<0 1>%a@;<0 -1>]@]"
(Format.pp_print_list
~pp_sep:(fun ppf () -> Format.fprintf ppf ";@ ")
(value lang))
l
| EStruct { name; fields } ->
Format.fprintf ppf "@[<hv 2>%a {@ %a@;<1 -2>}@]" StructName.format_t name
(Format.pp_print_list ~pp_sep:Format.pp_print_space (fun ppf (fld, e) ->
Format.fprintf ppf "-- %a: %a" StructField.format_t fld
(value lang) e))
(StructField.Map.bindings fields)
| EInj { name = _; cons; e } ->
Format.fprintf ppf "%a %a" EnumConstructor.format_t cons (value lang) e
| EEmptyError -> Format.pp_print_string ppf "ø"
| EAbs _ -> Format.pp_print_string ppf "<function>"
| EExternal _ -> Format.pp_print_string ppf "<external>"
| EApp _ | EOp _ | EVar _ | EIfThenElse _ | EMatch _ | ETupleAccess _
| EStructAccess _ | EAssert _ | EDefault _ | EErrorOnEmpty _ | ERaise _
| ECatch _ | ELocation _ ->
invalid_arg "UserPrint.value: not a value"
end

View File

@ -73,3 +73,28 @@ val scope :
unit unit
val program : ?debug:bool -> Format.formatter -> ('a, 'm) gexpr program -> unit val program : ?debug:bool -> Format.formatter -> ('a, 'm) gexpr program -> unit
(** User-facing, localised printer *)
module UserFacing : sig
val unit : Cli.backend_lang -> Format.formatter -> Runtime.unit -> unit
val bool : Cli.backend_lang -> Format.formatter -> Runtime.bool -> unit
val integer : Cli.backend_lang -> Format.formatter -> Runtime.integer -> unit
val decimal : Cli.backend_lang -> Format.formatter -> Runtime.decimal -> unit
val money : Cli.backend_lang -> Format.formatter -> Runtime.money -> unit
val date : Cli.backend_lang -> Format.formatter -> Runtime.date -> unit
val duration :
Cli.backend_lang -> Format.formatter -> Runtime.duration -> unit
val lit : Cli.backend_lang -> Format.formatter -> lit -> unit
val lit_to_string : Cli.backend_lang -> lit -> string
val value :
Cli.backend_lang ->
Format.formatter ->
((_, _) dcalc_lcalc, _) gexpr ->
unit
(** @raise Invalid_argument
if the supplied expression is a custom/external or anything that is not
a value *)
end

View File

@ -75,24 +75,24 @@ champ d'application Exemple2:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 $ catala Interpret -s Exemple1
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤96.48 [RESULT] montant = 96,48 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤96.48 [RESULT] montant = ESome 96,48 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple2 $ catala Interpret -s Exemple2
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤85.00 [RESULT] montant = 85,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_lcalc -s Exemple2 --avoid_exceptions $ catala Interpret_lcalc -s Exemple2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤85.00 [RESULT] montant = ESome 85,00 €
``` ```

View File

@ -128,47 +128,47 @@ champ d'application Exemple4 :
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 --disable_warnings $ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤345.73 [RESULT] montant = 345,73 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple2 --disable_warnings $ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤352.77 [RESULT] montant = 352,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤345.73 [RESULT] montant = ESome 345,73 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤352.77 [RESULT] montant = ESome 352,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple3 --disable_warnings $ catala Interpret -s Exemple3 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤339.70 [RESULT] montant = 339,70 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple4 --disable_warnings $ catala Interpret -s Exemple4 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤230.63 [RESULT] montant = 230,63 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_lcalc -s Exemple3 --disable_warnings --avoid_exceptions $ catala Interpret_lcalc -s Exemple3 --disable_warnings --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤339.70 [RESULT] montant = ESome 339,70 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_lcalc -s Exemple4 --disable_warnings --avoid_exceptions $ catala Interpret_lcalc -s Exemple4 --disable_warnings --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤230.63 [RESULT] montant = ESome 230,63 €
``` ```

View File

@ -34,10 +34,10 @@ champ d'application CasTest1:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest1 --disable_warnings $ catala Interpret -s CasTest1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤76.38 [RESULT] montant = 76,38 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest1 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤76.38 [RESULT] montant = ESome 76,38 €
``` ```

View File

@ -150,44 +150,44 @@ champ d'application Exemple4:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 --disable_warnings $ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤181.91 [RESULT] montant = 181,91 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple2 --disable_warnings $ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤67.34 [RESULT] montant = 67,34 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple3 --disable_warnings $ catala Interpret -s Exemple3 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤181.91 [RESULT] montant = 181,91 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple4 --disable_warnings $ catala Interpret -s Exemple4 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤118.59 [RESULT] montant = 118,59 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤181.91 [RESULT] montant = ESome 181,91 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤67.34 [RESULT] montant = ESome 67,34 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple3 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple3 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤181.91 [RESULT] montant = ESome 181,91 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple4 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple4 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤118.59 [RESULT] montant = ESome 118,59 €
``` ```

View File

@ -281,98 +281,98 @@ champ d'application Exemple9:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 --disable_warnings $ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤0.00 [RESULT] montant = 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple2 --disable_warnings $ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤352.77 [RESULT] montant = 352,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple3 --disable_warnings $ catala Interpret -s Exemple3 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤321.61 [RESULT] montant = 321,61 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple4 --disable_warnings $ catala Interpret -s Exemple4 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤0.00 [RESULT] montant = 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple5 --disable_warnings $ catala Interpret -s Exemple5 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤311.56 [RESULT] montant = 311,56 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple6 --disable_warnings $ catala Interpret -s Exemple6 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤0.00 [RESULT] montant = 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple7 --disable_warnings $ catala Interpret -s Exemple7 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤153.77 [RESULT] montant = 153,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple8 --disable_warnings $ catala Interpret -s Exemple8 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤11.06 [RESULT] montant = 11,06 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple9 --disable_warnings $ catala Interpret -s Exemple9 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤210.06 [RESULT] montant = 210,06 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤0.00 [RESULT] montant = ESome 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤352.77 [RESULT] montant = ESome 352,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple3 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple3 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤321.61 [RESULT] montant = ESome 321,61 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple4 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple4 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤0.00 [RESULT] montant = ESome 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple5 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple5 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤311.56 [RESULT] montant = ESome 311,56 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple6 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple6 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤0.00 [RESULT] montant = ESome 0,00 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple7 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple7 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤153.77 [RESULT] montant = ESome 153,77 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple8 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple8 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤11.06 [RESULT] montant = ESome 11,06 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple9 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple9 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤210.06 [RESULT] montant = ESome 210,06 €
``` ```

View File

@ -139,54 +139,54 @@ champ d'application CasTest5:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest1 --disable_warnings $ catala Interpret -s CasTest1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤12.06 [RESULT] montant = 12,06 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest2 --disable_warnings $ catala Interpret -s CasTest2 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤23.12 [RESULT] montant = 23,12 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest3 --disable_warnings $ catala Interpret -s CasTest3 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤154.78 [RESULT] montant = 154,78 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest4 --disable_warnings $ catala Interpret -s CasTest4 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤154.78 [RESULT] montant = 154,78 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s CasTest5 --disable_warnings $ catala Interpret -s CasTest5 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ¤129.65 [RESULT] montant = 129,65 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest1 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤12.06 [RESULT] montant = ESome 12,06 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest2 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤23.12 [RESULT] montant = ESome 23,12 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest3 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest3 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤154.78 [RESULT] montant = ESome 154,78 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest4 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest4 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤154.78 [RESULT] montant = ESome 154,78 €
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s CasTest5 --avoid_exceptions $ catala Interpret_Lcalc -s CasTest5 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant = ESome ¤129.65 [RESULT] montant = ESome 129,65 €
``` ```

View File

@ -158,40 +158,40 @@ champ d'application Exemple2 :
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 $ catala Interpret -s Exemple1
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ¤246.23 [RESULT] montant_versé = 246,23 €
[RESULT] éligibilité = true [RESULT] éligibilité = vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ESome ¤246.23 [RESULT] montant_versé = ESome 246,23 €
[RESULT] éligibilité = ESome true [RESULT] éligibilité = ESome vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions -O --closure_conversion $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions -O --closure_conversion
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ESome ¤246.23 [RESULT] montant_versé = ESome 246,23 €
[RESULT] éligibilité = ESome true [RESULT] éligibilité = ESome vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple2 $ catala Interpret -s Exemple2
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ¤230.63 [RESULT] montant_versé = 230,63 €
[RESULT] éligibilité = true [RESULT] éligibilité = vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_lcalc -s Exemple2 --avoid_exceptions $ catala Interpret_lcalc -s Exemple2 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ESome ¤230.63 [RESULT] montant_versé = ESome 230,63 €
[RESULT] éligibilité = ESome true [RESULT] éligibilité = ESome vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_lcalc -s Exemple2 -O --avoid_exceptions --closure_conversion $ catala Interpret_lcalc -s Exemple2 -O --avoid_exceptions --closure_conversion
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] montant_versé = ESome ¤230.63 [RESULT] montant_versé = ESome 230,63 €
[RESULT] éligibilité = ESome true [RESULT] éligibilité = ESome vrai
``` ```

View File

@ -215,13 +215,13 @@ champ d'application Exemple3 :
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Exemple1 --disable_warnings $ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] éligible = true [RESULT] éligible = vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions $ catala Interpret_Lcalc -s Exemple1 --avoid_exceptions
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] éligible = ESome true [RESULT] éligible = ESome vrai
``` ```

View File

@ -14,6 +14,9 @@
License for the specific language governing permissions and limitations under License for the specific language governing permissions and limitations under
the License. *) the License. *)
type nonrec unit = unit
type nonrec bool = bool
(* An integer number of cents *) (* An integer number of cents *)
type money = Z.t type money = Z.t
type integer = Z.t type integer = Z.t

View File

@ -19,11 +19,13 @@
(** {1 Types} *) (** {1 Types} *)
type money type nonrec unit = unit
type integer type nonrec bool = bool
type decimal type money = Z.t (** Number of cents *)
type date type integer = Z.t
type duration type decimal = Q.t
type date = Dates_calc.Dates.date
type duration = Dates_calc.Dates.period
type date_rounding = Dates_calc.Dates.date_rounding type date_rounding = Dates_calc.Dates.date_rounding
type source_position = { type source_position = {

View File

@ -18,7 +18,7 @@ $ catala Interpret -s A
[RESULT] w = 0 [RESULT] w = 0
[RESULT] x = 4 [RESULT] x = 4
[RESULT] y = 4 [RESULT] y = 4
[RESULT] z = 390. [RESULT] z = 390.0
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
@ -26,5 +26,5 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] w = ESome 0 [RESULT] w = ESome 0
[RESULT] x = ESome 4 [RESULT] x = ESome 4
[RESULT] y = ESome 4 [RESULT] y = ESome 4
[RESULT] z = ESome 390. [RESULT] z = ESome 390.0
``` ```

View File

@ -26,27 +26,27 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ ¤0.00; ¤9.00; ¤5.20 ] [RESULT] x = [$0.00; $9.00; $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] max = ¤18.00 [RESULT] max = $18.00
[RESULT] min = ¤5.00 [RESULT] min = $5.00
[RESULT] y = ¤17.20 [RESULT] y = $17.20
[RESULT] z = 1 [RESULT] z = 1
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome ¤0.00; ESome ¤9.00; ESome ¤5.20 ] [RESULT] x = ESome [ESome $0.00; ESome $9.00; ESome $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] max = ESome ¤18.00 [RESULT] max = ESome $18.00
[RESULT] min = ESome ¤5.00 [RESULT] min = ESome $5.00
[RESULT] y = ESome ¤17.20 [RESULT] y = ESome $17.20
[RESULT] z = ESome 1 [RESULT] z = ESome 1
``` ```

View File

@ -34,30 +34,28 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
x = x =
[ { S id = 0; income = ¤0.00; }; [S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
{ S id = 1; income = ¤9.00; }; S { -- id: 2 -- income: $5.20 }]
{ S id = 2; income = ¤5.20; } ]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] argmax = { S id = 1; income = ¤9.00; } [RESULT] argmax = S { -- id: 1 -- income: $9.00 }
[RESULT] argmin = { S id = 0; income = ¤0.00; } [RESULT] argmin = S { -- id: 0 -- income: $0.00 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
x = x =
ESome ESome [ESome S { -- id: ESome 0 -- income: ESome $0.00 };
[ ESome { S id = ESome 0; income = ESome ¤0.00; }; ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome { S id = ESome 1; income = ESome ¤9.00; }; ESome S { -- id: ESome 2 -- income: ESome $5.20 }]
ESome { S id = ESome 2; income = ESome ¤5.20; } ]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] argmax = ESome { S id = ESome 1; income = ESome ¤9.00; } [RESULT] argmax = ESome S { -- id: ESome 1 -- income: ESome $9.00 }
[RESULT] argmin = ESome { S id = ESome 0; income = ESome ¤0.00; } [RESULT] argmin = ESome S { -- id: ESome 0 -- income: ESome $0.00 }
``` ```

View File

@ -13,26 +13,16 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ 0; 1; 2; 3; 4; 5; 6 ] [RESULT] x = [0; 1; 2; 3; 4; 5; 6]
[RESULT] y = [ 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] [RESULT] y = [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
x = ESome [ ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6 ] x = ESome [ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6]
[RESULT] [RESULT]
y = y =
ESome ESome [ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6;
[ ESome 0; ESome 7; ESome 8; ESome 9; ESome 10]
ESome 1;
ESome 2;
ESome 3;
ESome 4;
ESome 5;
ESome 6;
ESome 7;
ESome 8;
ESome 9;
ESome 10 ]
``` ```

View File

@ -19,13 +19,13 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ ¤0.00; ¤9.00; ¤5.20 ] [RESULT] x = [$0.00; $9.00; $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome ¤0.00; ESome ¤9.00; ESome ¤5.20 ] [RESULT] x = ESome [ESome $0.00; ESome $9.00; ESome $5.20]
``` ```
@ -33,11 +33,11 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] y = [ ¤9.00; ¤5.20 ] [RESULT] y = [$9.00; $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] y = ESome [ ESome ¤9.00; ESome ¤5.20 ] [RESULT] y = ESome [ESome $9.00; ESome $5.20]
``` ```

View File

@ -20,23 +20,23 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ ¤0.00; ¤9.00; ¤5.20 ] [RESULT] x = [$0.00; $9.00; $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] y = [ ¤9.00; ¤5.20 ] [RESULT] y = [$9.00; $5.20]
[RESULT] z = [ false; true; true ] [RESULT] z = [false; true; true]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome ¤0.00; ESome ¤9.00; ESome ¤5.20 ] [RESULT] x = ESome [ESome $0.00; ESome $9.00; ESome $5.20]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] y = ESome [ ESome ¤9.00; ESome ¤5.20 ] [RESULT] y = ESome [ESome $9.00; ESome $5.20]
[RESULT] z = ESome [ ESome false; ESome true; ESome true ] [RESULT] z = ESome [ESome false; ESome true; ESome true]
``` ```

View File

@ -34,30 +34,28 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
x = x =
[ { S id = 0; income = ¤0.00; }; [S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
{ S id = 1; income = ¤9.00; }; S { -- id: 2 -- income: $5.20 }]
{ S id = 2; income = ¤5.20; } ]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] argmax = { S id = 1; income = ¤9.00; } [RESULT] argmax = S { -- id: 1 -- income: $9.00 }
[RESULT] argmin = { S id = 0; income = ¤0.00; } [RESULT] argmin = S { -- id: 0 -- income: $0.00 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
x = x =
ESome ESome [ESome S { -- id: ESome 0 -- income: ESome $0.00 };
[ ESome { S id = ESome 0; income = ESome ¤0.00; }; ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome { S id = ESome 1; income = ESome ¤9.00; }; ESome S { -- id: ESome 2 -- income: ESome $5.20 }]
ESome { S id = ESome 2; income = ESome ¤5.20; } ]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] argmax = ESome { S id = ESome 1; income = ESome ¤9.00; } [RESULT] argmax = ESome S { -- id: ESome 1 -- income: ESome $9.00 }
[RESULT] argmin = ESome { S id = ESome 0; income = ESome ¤0.00; } [RESULT] argmin = ESome S { -- id: ESome 0 -- income: ESome $0.00 }
``` ```

View File

@ -13,13 +13,13 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ ¤4.00; ¤8.00 ] [RESULT] x = [$4.00; $8.00]
[RESULT] z = [ false; true ] [RESULT] z = [false; true]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome ¤4.00; ESome ¤8.00 ] [RESULT] x = ESome [ESome $4.00; ESome $8.00]
[RESULT] z = ESome [ ESome false; ESome true ] [RESULT] z = ESome [ESome false; ESome true]
``` ```

View File

@ -24,7 +24,7 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ 0; 9; 64 ] [RESULT] x = [0; 9; 64]
``` ```
```catala-test-inline ```catala-test-inline
@ -38,7 +38,7 @@ $ catala Interpret -s B
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome 0; ESome 9; ESome 64 ] [RESULT] x = ESome [ESome 0; ESome 9; ESome 64]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize

View File

@ -14,12 +14,12 @@ scope A:
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] w = false [RESULT] w = false
[RESULT] x = [ 0; 9; 64 ] [RESULT] x = [0; 9; 64]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] w = ESome false [RESULT] w = ESome false
[RESULT] x = ESome [ ESome 0; ESome 9; ESome 64 ] [RESULT] x = ESome [ESome 0; ESome 9; ESome 64]
``` ```

View File

@ -11,11 +11,11 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = [ 0; 4; 8 ] [RESULT] x = [0; 4; 8]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome [ ESome 0; ESome 4; ESome 8 ] [RESULT] x = ESome [ESome 0; ESome 4; ESome 8]
``` ```

View File

@ -26,22 +26,22 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] m = [0 years, 0 months, 11874 days] [RESULT] m = [11874 days]
[RESULT] m2 = [0 years, 6 months, 0 days] [RESULT] m2 = [6 months]
[RESULT] x = 2019-01-01 [RESULT] x = 2019-01-01
[RESULT] y = 2002-09-30 [RESULT] y = 2002-09-30
[RESULT] z = true [RESULT] z = true
[RESULT] z2 = true [RESULT] z2 = true
[RESULT] z3 = [0 years, 0 months, 5937 days] [RESULT] z3 = [5937 days]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] m = ESome [0 years, 0 months, 11874 days] [RESULT] m = ESome [11874 days]
[RESULT] m2 = ESome [0 years, 6 months, 0 days] [RESULT] m2 = ESome [6 months]
[RESULT] x = ESome 2019-01-01 [RESULT] x = ESome 2019-01-01
[RESULT] y = ESome 2002-09-30 [RESULT] y = ESome 2002-09-30
[RESULT] z = ESome true [RESULT] z = ESome true
[RESULT] z2 = ESome true [RESULT] z2 = ESome true
[RESULT] z3 = ESome [0 years, 0 months, 5937 days] [RESULT] z3 = ESome [5937 days]
``` ```

View File

@ -25,5 +25,5 @@ champ d'application Test:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Test $ catala Interpret -s Test
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] r = true [RESULT] r = vrai
``` ```

View File

@ -17,12 +17,12 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = 2019-01-01 [RESULT] x = 2019-01-01
[RESULT] y = 2002-09-30 [RESULT] y = 2002-09-30
[RESULT] z = [0 years, 0 months, 5937 days] [RESULT] z = [5937 days]
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome 2019-01-01 [RESULT] x = ESome 2019-01-01
[RESULT] y = ESome 2002-09-30 [RESULT] y = ESome 2002-09-30
[RESULT] z = ESome [0 years, 0 months, 5937 days] [RESULT] z = ESome [5937 days]
``` ```

View File

@ -19,19 +19,18 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
a = a =
-0.000000000000000000000000000000000000000000000000000000000078695580959228473468… 0.000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,078,695,580,959,228,473,468…
[RESULT] x = 84.64866565265689623 [RESULT] x = 84.648,665,652,656,896,23
[RESULT] y = -4.3682977870532065498 [RESULT] y = -4.368,297,787,053,206,549,8
[RESULT] z = 654265429805103220650980650.570540510654 [RESULT] z = 654,265,429,805,103,220,650,980,650.5…
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
a = a =
ESome ESome 0.000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,078,695,580,959,228,473,468…
-0.000000000000000000000000000000000000000000000000000000000078695580959228473468… [RESULT] x = ESome 84.648,665,652,656,896,23
[RESULT] x = ESome 84.64866565265689623 [RESULT] y = ESome -4.368,297,787,053,206,549,8
[RESULT] y = ESome -4.3682977870532065498 [RESULT] z = ESome 654,265,429,805,103,220,650,980,650.5…
[RESULT] z = ESome 654265429805103220650980650.570540510654
``` ```

View File

@ -17,16 +17,16 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = 84.648665 [RESULT] x = 84.648,665
[RESULT] x1 = 85. [RESULT] x1 = 85.0
[RESULT] y = 4.368297 [RESULT] y = 4.368,297
[RESULT] y1 = 4. [RESULT] y1 = 4.0
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome 84.648665 [RESULT] x = ESome 84.648,665
[RESULT] x1 = ESome 85. [RESULT] x1 = ESome 85.0
[RESULT] y = ESome 4.368297 [RESULT] y = ESome 4.368,297
[RESULT] y1 = ESome 4. [RESULT] y1 = ESome 4.0
``` ```

View File

@ -5,24 +5,28 @@ declaration scope A:
context output x content decimal context output x content decimal
context output y content decimal context output y content decimal
context output z content decimal context output z content decimal
output k content decimal
scope A: scope A:
definition x equals 84.648665 definition x equals 84.648665
definition y equals 4.368297 definition y equals 4.368297
definition z equals x / y definition z equals x / y
definition k equals 1/3
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = 84.648665 [RESULT] k = 0.333,333,333,333,333,333,33…
[RESULT] y = 4.368297 [RESULT] x = 84.648,665
[RESULT] z = 19.37795552820698775747… [RESULT] y = 4.368,297
[RESULT] z = 19.377,955,528,206,987,757…
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome 84.648665 [RESULT] k = ESome 0.333,333,333,333,333,333,33…
[RESULT] y = ESome 4.368297 [RESULT] x = ESome 84.648,665
[RESULT] z = ESome 19.37795552820698775747… [RESULT] y = ESome 4.368,297
[RESULT] z = ESome 19.377,955,528,206,987,757…
``` ```

View File

@ -14,12 +14,12 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = 4. [RESULT] x = 4.0
[RESULT] y = 1.04 [RESULT] y = 1.04
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome 4. [RESULT] x = ESome 4.0
[RESULT] y = ESome 1.04 [RESULT] y = ESome 1.04
``` ```

View File

@ -49,12 +49,12 @@ scope Benefit:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Benefit $ catala Interpret -s Benefit
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] benefit = ¤2000.00 [RESULT] benefit = $2,000.00
[RESULT] person = { Person age = 26; disabled = true; } [RESULT] person = Person { -- age: 26 -- disabled: true }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Benefit --avoid_exceptions --optimize $ catala Interpret_Lcalc -s Benefit --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] benefit = ESome ¤2000.00 [RESULT] benefit = ESome $2,000.00
[RESULT] person = ESome { Person age = ESome 26; disabled = ESome true; } [RESULT] person = ESome Person { -- age: ESome 26 -- disabled: ESome true }
``` ```

View File

@ -34,8 +34,8 @@ scope T1:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s T1 $ catala Interpret -s T1
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] o1 = 20. [RESULT] o1 = 20.0
[RESULT] o2 = 5. [RESULT] o2 = 5.0
``` ```
## Multi-argument function ## Multi-argument function
@ -60,5 +60,5 @@ scope T2:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s T2 $ catala Interpret -s T2
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] o = 40. [RESULT] o = 40.0
``` ```

View File

@ -30,17 +30,17 @@ int main(void) { return 0; }
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = vrai
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = vrai
``` ```

View File

@ -30,17 +30,17 @@ int main(void) { return 0; }
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = prawda
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = prawda
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] literate_parsing_is_ok = true [RESULT] literate_parsing_is_ok = prawda
``` ```

View File

@ -14,12 +14,12 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ¤0.30 [RESULT] x = $0.30
[RESULT] y = ¤0.30 [RESULT] y = $0.30
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome ¤0.30 [RESULT] x = ESome $0.30
[RESULT] y = ESome ¤0.30 [RESULT] y = ESome $0.30
``` ```

View File

@ -15,14 +15,14 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ¤123.54 [RESULT] x = $123.54
[RESULT] y = ¤8548650.96 [RESULT] y = $8,548,650.96
[RESULT] z = ¤7.23 [RESULT] z = $7.23
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome ¤123.54 [RESULT] x = ESome $123.54
[RESULT] y = ESome ¤8548650.96 [RESULT] y = ESome $8,548,650.96
[RESULT] z = ESome ¤7.23 [RESULT] z = ESome $7.23
``` ```

View File

@ -28,8 +28,8 @@ scope S:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S $ catala Interpret -s S
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = { A x = -2.; y = { B y = false; z = -1.; }; } [RESULT] a = A { -- x: -2.0 -- y: B { -- y: false -- z: -1.0 } }
[RESULT] b = { B y = true; z = 42.; } [RESULT] b = B { -- y: true -- z: 42.0 }
``` ```
## Check scope of let-in vs scope variable ## Check scope of let-in vs scope variable
@ -55,8 +55,11 @@ $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
a = a =
ESome { A x = ESome -2.; y = ESome { B y = ESome false; z = ESome -1.; }; } ESome A {
[RESULT] b = ESome { B y = ESome true; z = ESome 42.; } -- x: ESome -2.0
-- y: ESome B { -- y: ESome false -- z: ESome -1.0 }
}
[RESULT] b = ESome B { -- y: ESome true -- z: ESome 42.0 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S2 --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S2 --avoid_exceptions --optimize

View File

@ -21,13 +21,17 @@ scope S:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S $ catala Interpret -s S
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = { A x = 0; y = { B y = true; z = 0.; }; } [RESULT] a = A { -- x: 0 -- y: B { -- y: true -- z: 0.0 } }
[RESULT] b = { B y = true; z = 0.; } [RESULT] b = B { -- y: true -- z: 0.0 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
a = ESome { A x = ESome 0; y = ESome { B y = ESome true; z = ESome 0.; }; } a =
[RESULT] b = ESome { B y = ESome true; z = ESome 0.; } ESome A {
-- x: ESome 0
-- y: ESome B { -- y: ESome true -- z: ESome 0.0 }
}
[RESULT] b = ESome B { -- y: ESome true -- z: ESome 0.0 }
``` ```

View File

@ -22,8 +22,8 @@ scope S:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S $ catala Interpret -s S
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = 1946.5744 [RESULT] a = 1,946.574,4
[RESULT] b = { A y = true; z = 2091.; } [RESULT] b = A { -- y: true -- z: 2,091.0 }
``` ```
## Test toplevel function defs ## Test toplevel function defs
@ -43,7 +43,7 @@ scope S2:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S2 $ catala Interpret -s S2
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = 154. [RESULT] a = 154.0
``` ```
## Test function def with two args ## Test function def with two args
@ -63,7 +63,7 @@ scope S3:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S3 $ catala Interpret -s S3
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = 2480. [RESULT] a = 2,480.0
``` ```
## Test inline defs in toplevel defs ## Test inline defs in toplevel defs
@ -86,7 +86,7 @@ scope S4:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s S4 $ catala Interpret -s S4
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = 6001. [RESULT] a = 6,001.0
``` ```
```catala-test-inline ```catala-test-inline
@ -465,21 +465,21 @@ def s(s_in:SIn):
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = ESome 1946.5744 [RESULT] a = ESome 1,946.574,4
[RESULT] b = ESome { A y = ESome true; z = ESome 2091.; } [RESULT] b = ESome A { -- y: ESome true -- z: ESome 2,091.0 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S2 --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S2 --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = ESome 154. [RESULT] a = ESome 154.0
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S3 --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S3 --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = ESome 2480. [RESULT] a = ESome 2,480.0
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S4 --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S4 --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] a = ESome 6001. [RESULT] a = ESome 6,001.0
``` ```

View File

@ -21,12 +21,12 @@ scope Titi:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s Titi $ catala Interpret -s Titi
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] fizz = { Toto foo = 1213; } [RESULT] fizz = Toto { -- foo: 1,213 }
[RESULT] fuzz = { Toto foo = 1323; } [RESULT] fuzz = Toto { -- foo: 1,323 }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s Titi --avoid_exceptions --optimize $ catala Interpret_Lcalc -s Titi --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] fizz = ESome { Toto foo = ESome 1213; } [RESULT] fizz = ESome Toto { -- foo: ESome 1,213 }
[RESULT] fuzz = ESome { Toto foo = ESome 1323; } [RESULT] fuzz = ESome Toto { -- foo: ESome 1,323 }
``` ```

View File

@ -69,28 +69,6 @@ $ catala Interpret -t -s HousingComputation
[LOG] ← HousingComputation.f [LOG] ← HousingComputation.f
[LOG] ≔ HousingComputation.result: 3 [LOG] ≔ HousingComputation.result: 3
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT] f = <function>
f = λ (x: integer) →
error_empty
⟨true
⊢ (let result : RentComputation =
(λ (RentComputation_in: RentComputation_in) →
let g : integer → integer =
λ (x1: integer) →
error_empty ⟨true ⊢ x1 + 1⟩
in
let f : integer → integer =
λ (x1: integer) →
error_empty ⟨true ⊢ g (x1 + 1)⟩
in
{ RentComputation f = f; })
{RentComputation_in}
in
let result1 : RentComputation =
{ RentComputation f = λ (param0: integer) → result.f param0; }
in
if true then result1 else result1).
f
x⟩
[RESULT] result = 3 [RESULT] result = 3
``` ```

View File

@ -25,41 +25,13 @@ scope RentComputation:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s RentComputation $ catala Interpret -s RentComputation
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT] f1 = <function>
f1 = λ (x: integer) → [RESULT] f2 = <function>
error_empty ⟨true ⊢ let x1 : integer = x + 1 in
error_empty ⟨true ⊢ x1 + 1⟩⟩
[RESULT]
f2 = λ (x: integer) →
error_empty ⟨true ⊢ let x1 : integer = x + 1 in
error_empty ⟨true ⊢ x1 + 1⟩⟩
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s RentComputation --avoid_exceptions --optimize $ catala Interpret_Lcalc -s RentComputation --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT] f1 = ESome <function>
f1 = [RESULT] f2 = ESome <function>
ESome
(λ (x: integer) →
ESome
match
(match (ESome (λ (x1: integer) → ESome (x1 + 1))) with
| ENone _ → ENone _
| ESome g → g (x + 1))
with
| ENone _ → raise NoValueProvided
| ESome f1 → f1)
[RESULT]
f2 =
ESome
(λ (x: integer) →
ESome
match
(match (ESome (λ (x1: integer) → ESome (x1 + 1))) with
| ENone _ → ENone _
| ESome g → g (x + 1))
with
| ENone _ → raise NoValueProvided
| ESome f2 → f2)
``` ```

View File

@ -37,24 +37,25 @@ scope B:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] t = { T a = { S x = 0; y = false; }; b = { S x = 1; y = true; }; } [RESULT]
t = T { -- a: S { -- x: 0 -- y: false } -- b: S { -- x: 1 -- y: true } }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret -s B $ catala Interpret -s B
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] out = 1 [RESULT] out = 1
[RESULT] t = { T a = { S x = 0; y = false; }; b = { S x = 1; y = true; }; } [RESULT]
t = T { -- a: S { -- x: 0 -- y: false } -- b: S { -- x: 1 -- y: true } }
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] [RESULT]
t = t =
ESome ESome T {
{ T -- a: ESome S { -- x: ESome 0 -- y: ESome false }
a = ESome { S x = ESome 0; y = ESome false; }; -- b: ESome S { -- x: ESome 1 -- y: ESome true }
b = ESome { S x = ESome 1; y = ESome true; };
} }
``` ```
```catala-test-inline ```catala-test-inline
@ -63,9 +64,8 @@ $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] out = ESome 1 [RESULT] out = ESome 1
[RESULT] [RESULT]
t = t =
ESome ESome T {
{ T -- a: ESome S { -- x: ESome 0 -- y: ESome false }
a = ESome { S x = ESome 0; y = ESome false; }; -- b: ESome S { -- x: ESome 1 -- y: ESome true }
b = ESome { S x = ESome 1; y = ESome true; };
} }
``` ```

View File

@ -26,7 +26,7 @@ $ catala Interpret -s A
│ ‾‾‾ │ ‾‾‾
└─ Article └─ Article
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = { Foo f = 1; } [RESULT] x = Foo { -- f: 1 }
[RESULT] y = 1 [RESULT] y = 1
``` ```
```catala-test-inline ```catala-test-inline
@ -39,6 +39,6 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
│ ‾‾‾ │ ‾‾‾
└─ Article └─ Article
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] x = ESome { Foo f = ESome 1; } [RESULT] x = ESome Foo { -- f: ESome 1 }
[RESULT] y = ESome 1 [RESULT] y = ESome 1
``` ```

View File

@ -20,12 +20,12 @@ scope A:
```catala-test-inline ```catala-test-inline
$ catala Interpret -s A $ catala Interpret -s A
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] s = { S x = 1; y = 2; } [RESULT] s = S { -- x: 1 -- y: 2 }
[RESULT] z = 3 [RESULT] z = 3
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] s = ESome { S x = ESome 1; y = ESome 2; } [RESULT] s = ESome S { -- x: ESome 1 -- y: ESome 2 }
[RESULT] z = ESome 3 [RESULT] z = ESome 3
``` ```

View File

@ -61,19 +61,19 @@ scope S:
$ catala Interpret -s S $ catala Interpret -s S
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] o_b = true [RESULT] o_b = true
[RESULT] o_d = [0 years, 0 months, -13 days] [RESULT] o_d = [-13 days]
[RESULT] o_i = -5 [RESULT] o_i = -5
[RESULT] o_m = ¤-5.75 [RESULT] o_m = $-5.75
[RESULT] o_t = 2022-01-24 [RESULT] o_t = 2022-01-24
[RESULT] o_x = 0.14285714285714285714… [RESULT] o_x = 0.142,857,142,857,142,857,14…
``` ```
```catala-test-inline ```catala-test-inline
$ catala Interpret_Lcalc -s S --avoid_exceptions --optimize $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results: [RESULT] Computation successful! Results:
[RESULT] o_b = ESome true [RESULT] o_b = ESome true
[RESULT] o_d = ESome [0 years, 0 months, -13 days] [RESULT] o_d = ESome [-13 days]
[RESULT] o_i = ESome -5 [RESULT] o_i = ESome -5
[RESULT] o_m = ESome ¤-5.75 [RESULT] o_m = ESome $-5.75
[RESULT] o_t = ESome 2022-01-24 [RESULT] o_t = ESome 2022-01-24
[RESULT] o_x = ESome 0.14285714285714285714… [RESULT] o_x = ESome 0.142,857,142,857,142,857,14…
``` ```