Don't put a box in list printing but do indent (#524)

Don't put a box in list printing but do indent
This commit is contained in:
Denis Merigoux 2023-11-02 11:56:57 +01:00 committed by GitHub
commit c46f5d568d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 32 deletions

View File

@ -1052,7 +1052,7 @@ module UserFacing = struct
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.fprintf ppf "@[<hv 2>[@,@[<hov>%a@]@;<0 -2>]@]"
(Format.pp_print_list
~pp_sep:(fun ppf () -> Format.fprintf ppf ";@ ")
(value ~fallback lang))
@ -1061,10 +1061,11 @@ module UserFacing = struct
Format.fprintf ppf "@[<hv 2>%a {@ %a@;<1 -2>}@]" StructName.format name
(StructField.Map.format_bindings ~pp_sep:Format.pp_print_space
(fun ppf pp_fld e ->
Format.fprintf ppf "-- %t: %a" pp_fld (value ~fallback lang) e))
Format.fprintf ppf "@[<hov 2>-- %t:@ %a@]" pp_fld
(value ~fallback lang) e))
fields
| EInj { name = _; cons; e } ->
Format.fprintf ppf "%a %a" EnumConstructor.format cons
Format.fprintf ppf "@[<hov 2>%a@ %a@]" EnumConstructor.format cons
(value ~fallback lang) e
| EEmptyError -> Format.pp_print_string ppf "ø"
| EAbs _ -> Format.pp_print_string ppf "<function>"

View File

@ -34,8 +34,10 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results:
[RESULT]
x =
[S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
S { -- id: 2 -- income: $5.20 }]
[
S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
S { -- id: 2 -- income: $5.20 }
]
```
```catala-test-inline
@ -49,9 +51,12 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
x =
ESome [ESome S { -- id: ESome 0 -- income: ESome $0.00 };
ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome S { -- id: ESome 2 -- income: ESome $5.20 }]
ESome
[
ESome S { -- id: ESome 0 -- income: ESome $0.00 };
ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome S { -- id: ESome 2 -- income: ESome $5.20 }
]
```
```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize

View File

@ -23,6 +23,9 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
x = ESome [ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6]
[RESULT]
y =
ESome [ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6;
ESome 7; ESome 8; ESome 9; ESome 10]
ESome
[
ESome 0; ESome 1; ESome 2; ESome 3; ESome 4; ESome 5; ESome 6;
ESome 7; ESome 8; ESome 9; ESome 10
]
```

View File

@ -34,8 +34,10 @@ $ catala Interpret -s A
[RESULT] Computation successful! Results:
[RESULT]
x =
[S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
S { -- id: 2 -- income: $5.20 }]
[
S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
S { -- id: 2 -- income: $5.20 }
]
```
```catala-test-inline
@ -49,9 +51,12 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
x =
ESome [ESome S { -- id: ESome 0 -- income: ESome $0.00 };
ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome S { -- id: ESome 2 -- income: ESome $5.20 }]
ESome
[
ESome S { -- id: ESome 0 -- income: ESome $0.00 };
ESome S { -- id: ESome 1 -- income: ESome $9.00 };
ESome S { -- id: ESome 2 -- income: ESome $5.20 }
]
```
```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize

View File

@ -29,7 +29,8 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
a =
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…
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…
[RESULT] x = ESome 84.648,665,652,656,896,23
[RESULT] y = ESome -4.368,297,787,053,206,549,8
[RESULT] z = ESome 654,265,429,805,103,220,650,980,650.5…

View File

@ -55,10 +55,11 @@ $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
a =
ESome A {
-- x: ESome -2.0
-- y: ESome B { -- y: ESome false -- z: ESome -1.0 }
}
ESome
A {
-- 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

View File

@ -29,9 +29,7 @@ $ catala Interpret_Lcalc -s S --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
a =
ESome A {
-- x: ESome 0
-- y: ESome B { -- y: ESome true -- z: ESome 0.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

@ -53,10 +53,11 @@ $ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[RESULT] Computation successful! Results:
[RESULT]
t =
ESome T {
-- a: ESome S { -- x: ESome 0 -- y: ESome false }
-- b: ESome S { -- x: ESome 1 -- y: ESome true }
}
ESome
T {
-- a: ESome S { -- x: ESome 0 -- y: ESome false }
-- b: ESome S { -- x: ESome 1 -- y: ESome true }
}
```
```catala-test-inline
$ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
@ -64,8 +65,9 @@ $ catala Interpret_Lcalc -s B --avoid_exceptions --optimize
[RESULT] out = ESome 1
[RESULT]
t =
ESome T {
-- a: ESome S { -- x: ESome 0 -- y: ESome false }
-- b: ESome S { -- x: ESome 1 -- y: ESome true }
}
ESome
T {
-- a: ESome S { -- x: ESome 0 -- y: ESome false }
-- b: ESome S { -- x: ESome 1 -- y: ESome true }
}
```