diff --git a/Makefile b/Makefile index 78a2074f..ccd347eb 100644 --- a/Makefile +++ b/Makefile @@ -174,16 +174,16 @@ generate_french_law_library:\ build_french_law_library: generate_french_law_library format dune build $(FRENCH_LAW_LIB_DIR) -run_french_law_library_benchmark: build_french_law_library +run_french_law_library_benchmark: generate_french_law_library dune exec $(FRENCH_LAW_LIB_DIR)/bench.exe -run_french_law_library_tests: build_french_law_library +run_french_law_library_tests: generate_french_law_library dune exec $(FRENCH_LAW_LIB_DIR)/law_source/unit_tests/run_tests.exe #> build_french_law_library_js : Builds the JS version of the OCaml French law library build_french_law_library_js: generate_french_law_library format dune build --profile release $(FRENCH_LAW_LIB_DIR)/api_web.bc.js - cd javascript && ln -sf ../_build/default/$(FRENCH_LAW_LIB_DIR)/api_web.bc.js french_law.js + cp -f _build/default/$(FRENCH_LAW_LIB_DIR)/api_web.bc.js french_law_js/french_law.js ########################################## # Website assets diff --git a/catala.opam b/catala.opam index c94c54a3..267b9c2d 100644 --- a/catala.opam +++ b/catala.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "0.2.0" +version: "0.3.0" synopsis: "Low-level language for tax code specification" description: """ The Catala language is designed to be a low-level target for @@ -28,6 +28,8 @@ depends: [ "calendar" {>= "2.04"} "visitors" {>= "20200210"} "benchmark" {>= "1.6"} + "js_of_ocaml-ppx" {>= "3.8.0"} + "camomile" {>= "1.0.2"} ] build: [ ["dune" "subst"] {pinned} diff --git a/doc/images/ScreenShotVSCode.png b/doc/images/ScreenShotVSCode.png index 68012582..551407f8 100644 Binary files a/doc/images/ScreenShotVSCode.png and b/doc/images/ScreenShotVSCode.png differ diff --git a/dune-project b/dune-project index 067321a1..087ffe90 100644 --- a/dune-project +++ b/dune-project @@ -1,7 +1,7 @@ (lang dune 2.2) (name catala) -(version 0.2.0) +(version 0.3.0) (generate_opam_files true) (formatting) @@ -36,8 +36,10 @@ (calendar (>= 2.04)) (visitors (>= 20200210)) (benchmark (>= 1.6)) + (js_of_ocaml-ppx (>= 3.8.0)) + (camomile (>= 1.0.2)) ) ) (using menhir 2.1) -(allow_approximate_merlin) \ No newline at end of file +(allow_approximate_merlin) \ No newline at end of file diff --git a/examples/allocations_familiales/decrets_divers.catala_fr b/examples/allocations_familiales/decrets_divers.catala_fr index c543548c..626974ce 100644 --- a/examples/allocations_familiales/decrets_divers.catala_fr +++ b/examples/allocations_familiales/decrets_divers.catala_fr @@ -22,8 +22,8 @@ familiales, est ainsi porté de 411,92 € à 413,16 € au 1er avril 2019. champ d'application PrestationsFamiliales : définition base_mensuelle sous condition - date_courante >=@ |01/04/2019| et - date_courante <@ |01/04/2020| + date_courante >=@ |2019-04-01| et + date_courante <@ |2020-04-01| conséquence égal à 413,16 € ``` @@ -46,8 +46,8 @@ est ainsi porté de 413,16 € à 414,4 € au 1er avril 2020. champ d'application PrestationsFamiliales : définition base_mensuelle sous condition - date_courante >=@ |01/04/2020| et - date_courante <@ |01/04/2021| + date_courante >=@ |2020-04-01| et + date_courante <@ |2021-04-01| conséquence égal à 414,4 € ``` @@ -75,14 +75,14 @@ tranche est celle dont les revenus sont supérieurs au plafond de base de champ d'application AllocationsFamiliales : exception définition plafond_I_d521_3 sous condition - date_courante >=@ |01/01/2020| et date_courante <=@ |31/12/2020| + date_courante >=@ |2020-01-01| et date_courante <=@ |2020-12-31| conséquence égal à 57 759 € +€ 5 775 € *€ (entier_vers_décimal de (nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) exception définition plafond_II_d521_3 sous condition - date_courante >=@ |01/01/2020| et date_courante <=@ |31/12/2020| + date_courante >=@ |2020-01-01| et date_courante <=@ |2020-12-31| conséquence égal à 80 831 € +€ 5 775 € *€ (entier_vers_décimal de (nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) @@ -105,7 +105,7 @@ son montant est porté à 10,03 € l'heure. ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2019| et date_courante <=@ |31/12/2019| et ( + date_courante >=@ |2019-01-01| et date_courante <=@ |2019-12-31| et ( (résidence = Métropole) ou (résidence = Guadeloupe) ou (résidence = Guyane) ou @@ -123,7 +123,7 @@ champ d'application Smic : ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2019| et date_courante <=@ |31/12/2019| et ( + date_courante >=@ |2019-01-01| et date_courante <=@ |2019-12-31| et ( (résidence = Mayotte) ) conséquence égal à 7,57 € @@ -144,7 +144,7 @@ son montant est porté à 10,15 € l'heure ; ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2020| et date_courante <=@ |31/12/2020| et ( + date_courante >=@ |2020-01-01| et date_courante <=@ |2020-12-31| et ( (résidence = Métropole) ou (résidence = Guadeloupe) ou (résidence = Guyane) ou @@ -162,7 +162,7 @@ champ d'application Smic : ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2020| et date_courante <=@ |31/12/2020| et ( + date_courante >=@ |2020-01-01| et date_courante <=@ |2020-12-31| et ( (résidence = Mayotte) ) conséquence égal à 7,66 € @@ -183,7 +183,7 @@ son montant est porté à 10,25 € l'heure ; ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2021| et date_courante <=@ |31/12/2021| et ( + date_courante >=@ |2021-01-01| et date_courante <=@ |2021-12-31| et ( (résidence = Métropole) ou (résidence = Guadeloupe) ou (résidence = Guyane) ou @@ -201,7 +201,7 @@ champ d'application Smic : ```catala champ d'application Smic : définition brut_horaire sous condition - date_courante >=@ |01/01/2021| et date_courante <=@ |31/12/2021| et ( + date_courante >=@ |2021-01-01| et date_courante <=@ |2021-12-31| et ( (résidence = Mayotte) ) conséquence égal à 7,74 € @@ -221,7 +221,7 @@ décembre 2021. Il est majoré de 5 827 euros par enfant à charge. champ d'application AllocationsFamiliales : exception définition plafond_I_d521_3 sous condition - date_courante >=@ |01/01/2021| et date_courante <=@ |31/12/2021| + date_courante >=@ |2021-01-01| et date_courante <=@ |2021-12-31| conséquence égal à 58 279 € +€ 5 827 € *€ (entier_vers_décimal de (nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) @@ -237,7 +237,7 @@ décembre 2021. Il est majoré de 5 827 euros par enfant à charge. champ d'application AllocationsFamiliales : exception définition plafond_II_d521_3 sous condition - date_courante >=@ |01/01/2021| et date_courante <=@ |31/12/2021| + date_courante >=@ |2021-01-01| et date_courante <=@ |2021-12-31| conséquence égal à 81 558 € +€ 5 827 € *€ (entier_vers_décimal de (nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) diff --git a/examples/allocations_familiales/epilogue.catala_fr b/examples/allocations_familiales/epilogue.catala_fr index b041cc0f..8d90cd7a 100644 --- a/examples/allocations_familiales/epilogue.catala_fr +++ b/examples/allocations_familiales/epilogue.catala_fr @@ -14,20 +14,16 @@ champ d'application EnfantLePlusÂgé: définition le_plus_âgé égal à contenu maximum entier initial Enfant { -- identifiant: -1 - -- fin_obligation_scolaire: |01/01/1900| + -- obligation_scolaire: Pendant -- rémuneration_mensuelle: 0€ - -- date_de_naissance: |01/01/1900| + -- date_de_naissance: |1900-01-01| -- âge: 0 - -- garde_alternée: NonGardeUnique - -- prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille + -- prise_en_charge: EffectiveEtPermanente + -- a_déjà_ouvert_droit_aux_allocations_familiales: faux } - pour potentiel_plus_âgé dans enfants de - potentiel_plus_âgé.âge + pour potentiel_plus_âgé dans enfants de potentiel_plus_âgé.âge -champ d'application PrestationsFamiliales: - définition âge_l512_3_2_alternatif égal à Absent - champ d'application AllocationsFamiliales: définition montant_initial_majoration de enfant sous condition non (droit_ouvert_majoration de enfant) @@ -75,9 +71,8 @@ déclaration structure EnfantEntrée: donnée d_identifiant contenu entier donnée d_rémuneration_mensuelle contenu argent donnée d_date_de_naissance contenu date - donnée d_garde_alternée contenu GardeAlternée - donnée d_prise_en_charge_par_services_sociaux contenu - PriseEnChargeServiceSociaux + donnée d_prise_en_charge contenu PriseEnCharge + donnée d_a_déjà_ouvert_droit_aux_allocations_familiales contenu booléen déclaration champ d'application InterfaceAllocationsFamiliales: contexte date_courante contenu date @@ -87,6 +82,8 @@ déclaration champ d'application InterfaceAllocationsFamiliales: contexte ressources_ménage contenu argent contexte résidence contenu Collectivité contexte montant_versé contenu argent + contexte personne_charge_effective_permanente_est_parent condition + contexte personne_charge_effective_permanente_remplit_titre_I condition champ d'application InterfaceAllocationsFamiliales: définition allocations_familiales.date_courante égal à date_courante @@ -94,10 +91,12 @@ champ d'application InterfaceAllocationsFamiliales: définition allocations_familiales.ressources_ménage égal à ressources_ménage définition allocations_familiales.résidence égal à résidence définition montant_versé égal à allocations_familiales.montant_versé - assertion non (existe enfant dans enfants tel que - enfant.d_garde_alternée != NonGardeUnique et - enfant.d_prise_en_charge_par_services_sociaux != NonPriseEnChargeFamille - ) + règle allocations_familiales.personne_charge_effective_permanente_est_parent + sous condition personne_charge_effective_permanente_est_parent conséquence + rempli + règle allocations_familiales.personne_charge_effective_permanente_remplit_titre_I + sous condition personne_charge_effective_permanente_remplit_titre_I conséquence + rempli ``` > Fin métadonnées @@ -119,11 +118,16 @@ champ d'application InterfaceAllocationsFamiliales: -- identifiant : enfant.d_identifiant -- rémuneration_mensuelle : enfant.d_rémuneration_mensuelle -- date_de_naissance : enfant.d_date_de_naissance - -- prise_en_charge_par_services_sociaux : - enfant.d_prise_en_charge_par_services_sociaux - -- garde_alternée : enfant.d_garde_alternée + -- prise_en_charge : enfant.d_prise_en_charge -- âge: accès_année de - (|01/01/0000| +@ (date_courante -@ enfant.d_date_de_naissance)) - -- fin_obligation_scolaire : enfant.d_date_de_naissance +@ 16 an + (|0000-01-01| +@ (date_courante -@ enfant.d_date_de_naissance)) + -- obligation_scolaire : + (si enfant.d_date_de_naissance +@ 3 an >=@ date_courante alors + Avant + sinon (si enfant.d_date_de_naissance +@ 16 an >=@ date_courante alors + Pendant + sinon Après)) + -- a_déjà_ouvert_droit_aux_allocations_familiales: + enfant.d_a_déjà_ouvert_droit_aux_allocations_familiales } ``` diff --git a/examples/allocations_familiales/prologue.catala_fr b/examples/allocations_familiales/prologue.catala_fr index 6a1fdf89..2f45b481 100644 --- a/examples/allocations_familiales/prologue.catala_fr +++ b/examples/allocations_familiales/prologue.catala_fr @@ -5,30 +5,27 @@ allocations familiales, il est nécessaire de définir les structures de donnée informatiques qui modélisent la situation dont parlent ces textes législatifs. > Début métadonnées - ```catala -déclaration structure Personne: - donnée numéro_sécurité_sociale contenu entier +déclaration énumération PriseEnCharge : + -- GardeAlternéePartageAllocations + -- GardeAlternéeAllocataireUnique + -- EffectiveEtPermanente + -- ServicesSociauxAllocationVerséeÀLaFamille + -- ServicesSociauxAllocationVerséeAuxServicesSociaux -déclaration énumération GardeAlternée : - -- OuiPartageAllocations - -- OuiAllocataireUnique - -- NonGardeUnique - -déclaration énumération PriseEnChargeServiceSociaux: - -- OuiAllocationVerséeÀLaFamille - -- OuiAllocationVerséeAuxServicesSociaux - -- NonPriseEnChargeFamille +déclaration énumération SituationObligationScolaire: + -- Avant + -- Pendant + -- Après déclaration structure Enfant : donnée identifiant contenu entier - donnée fin_obligation_scolaire contenu date + donnée obligation_scolaire contenu SituationObligationScolaire donnée rémuneration_mensuelle contenu argent donnée date_de_naissance contenu date donnée âge contenu entier - donnée garde_alternée contenu GardeAlternée - donnée prise_en_charge_par_services_sociaux contenu - PriseEnChargeServiceSociaux + donnée prise_en_charge contenu PriseEnCharge + donnée a_déjà_ouvert_droit_aux_allocations_familiales contenu booléen déclaration énumération Collectivité : -- Guadeloupe @@ -46,18 +43,15 @@ déclaration champ d'application Smic : contexte résidence contenu Collectivité contexte brut_horaire contenu argent -déclaration énumération PriseEnCompteÉvaluationMontant: +déclaration énumération PriseEnCompte: -- Complète -- Partagée + -- Zéro déclaration énumération VersementAllocations: -- Normal -- AllocationVerséeAuxServicesSociaux -déclaration énumération ÂgeAlternatif: - -- Absent - -- Présent contenu entier - déclaration énumération ÉlémentPrestationsFamiliales: -- PrestationAccueilJeuneEnfant -- AllocationsFamiliales @@ -73,7 +67,6 @@ déclaration champ d'application PrestationsFamiliales: contexte conditions_hors_âge condition dépend de Enfant contexte plafond_l512_3_2 contenu argent contexte âge_l512_3_2 contenu entier - contexte âge_l512_3_2_alternatif contenu ÂgeAlternatif contexte régime_outre_mer_l751_1 condition contexte date_courante contenu date contexte prestation_courante contenu ÉlémentPrestationsFamiliales @@ -86,32 +79,34 @@ champ d'application PrestationsFamiliales: définition smic.date_courante égal à date_courante déclaration champ d'application AllocationFamilialesAvril2008: - contexte âge_limite_alinéa_1_l521_3 contenu entier - -déclaration énumération StockageEnfant: - -- PasEnfant - -- UnEnfant contenu Enfant + contexte âge_minimum_alinéa_1_l521_3 contenu entier déclaration champ d'application EnfantLePlusÂgé: contexte enfants contenu collection Enfant contexte le_plus_âgé contenu Enfant déclaration champ d'application AllocationsFamiliales: + + # Variables concernant le ménage + contexte personne_charge_effective_permanente_est_parent condition + contexte personne_charge_effective_permanente_remplit_titre_I condition + contexte ressources_ménage contenu argent + contexte résidence contenu Collectivité + + # Date à laquelle le calcul est effectué + contexte date_courante contenu date + + # Variables concernant les enfants du ménage contexte enfants_à_charge contenu collection Enfant contexte enfants_à_charge_droit_ouvert_prestation_familiale contenu collection Enfant - contexte date_courante contenu date - contexte résidence contenu Collectivité - contexte ressources_ménage contenu argent - contexte prise_en_compte contenu - PriseEnCompteÉvaluationMontant dépend de Enfant - contexte versement contenu - VersementAllocations dépend de Enfant + contexte prise_en_compte contenu PriseEnCompte dépend de Enfant + contexte versement contenu VersementAllocations dépend de Enfant contexte montant_versé contenu argent + # Variables liées à la base des allications familiales contexte droit_ouvert_base condition - contexte droit_ouvert_majoration condition dépend de Enfant contexte montant_versé_base contenu argent contexte montant_avec_garde_alternée_base contenu argent contexte montant_initial_base contenu argent @@ -122,26 +117,31 @@ déclaration champ d'application AllocationsFamiliales: contexte nombre_moyen_enfants contenu décimal contexte nombre_total_enfants contenu décimal + # Variables liées à l'allocation forfaitaire contexte droit_ouvert_forfaitaire condition dépend de Enfant contexte montant_versé_forfaitaire contenu argent + # Variables liées aux majorations des allocations familiales + contexte droit_ouvert_majoration condition dépend de Enfant contexte montant_versé_majoration contenu argent contexte montant_avec_garde_alternée_majoration contenu argent dépend de Enfant contexte montant_initial_majoration contenu argent dépend de Enfant + # Variables liées au complément dégressif contexte droit_ouvert_complément condition contexte montant_versé_complément_pour_base_et_majoration contenu argent contexte montant_base_complément_pour_base_et_majoration contenu argent contexte montant_versé_complément_pour_forfaitaire contenu argent - contexte dépassement_plafond_ressources contenu argent dépend de argent + contexte complément_dégressif contenu argent dépend de argent + # Sous-champs d'applications contexte prestations_familiales champ d'application PrestationsFamiliales contexte version_avril_2008 champ d'application AllocationFamilialesAvril2008 contexte enfant_le_plus_âgé champ d'application EnfantLePlusÂgé - contexte conditions_hors_âge condition dépend de Enfant + # Plafonds, âges limites et autres constantes contexte nombre_enfants_l521_1 contenu entier - contexte âge_limite_alinéa_1_l521_3 contenu entier dépend de Enfant + contexte âge_minimum_alinéa_1_l521_3 contenu entier dépend de Enfant contexte nombre_enfants_alinéa_2_l521_3 contenu entier contexte est_enfant_le_plus_âgé contenu booléen dépend de Enfant contexte plafond_I_d521_3 contenu argent @@ -156,5 +156,4 @@ champ d'application AllocationsFamiliales: résidence ``` - > Fin métadonnées diff --git a/examples/allocations_familiales/securite_sociale_D.catala_fr b/examples/allocations_familiales/securite_sociale_D.catala_fr index a8c8e668..577168d3 100644 --- a/examples/allocations_familiales/securite_sociale_D.catala_fr +++ b/examples/allocations_familiales/securite_sociale_D.catala_fr @@ -79,7 +79,7 @@ champ d'application AllocationsFamiliales : (ressources_ménage <=€ plafond_II_d521_3) conséquence égal à si nombre de enfants_à_charge_droit_ouvert_prestation_familiale >= 2 - alors prestations_familiales.base_mensuelle *€ 32 % + alors prestations_familiales.base_mensuelle *€ 16 % sinon 0 € ``` @@ -172,28 +172,28 @@ définie à l'alinéa précédent et, d'autre part, le montant des ressources. ```catala champ d'application AllocationsFamiliales : exception - définition dépassement_plafond_ressources de allocation + définition complément_dégressif de allocation sous condition (ressources_ménage >€ plafond_I_d521_3) et (ressources_ménage <=€ plafond_I_d521_3 +€ allocation *€ 12,0 ) conséquence égal à - plafond_I_d521_3 +€ allocation *€ 12,0 -€ ressources_ménage + (plafond_I_d521_3 +€ allocation *€ 12,0 -€ ressources_ménage) *€ (1,0 /. 12,0) exception - définition dépassement_plafond_ressources de allocation + définition complément_dégressif de allocation sous condition (ressources_ménage >€ plafond_II_d521_3) et (ressources_ménage <=€ plafond_II_d521_3 +€ allocation *€ 12,0) conséquence égal à - plafond_II_d521_3 +€ allocation *€ 12,0 -€ ressources_ménage + (plafond_II_d521_3 +€ allocation *€ 12,0 -€ ressources_ménage) *€ (1,0 /. 12,0) # Dans les autres cas, le dépassement est nul - définition dépassement_plafond_ressources de allocations égal à 0 € + définition complément_dégressif de allocations égal à 0 € définition montant_versé_complément_pour_base_et_majoration égal à si droit_ouvert_complément alors - (dépassement_plafond_ressources de - montant_base_complément_pour_base_et_majoration) *€ (1,0 /. 12,0) + (complément_dégressif de + montant_base_complément_pour_base_et_majoration) sinon 0 € définition montant_base_complément_pour_base_et_majoration égal à @@ -265,8 +265,7 @@ l'alinéa précédent et, d'autre part, le montant des ressources. champ d'application AllocationsFamiliales : définition montant_versé_complément_pour_forfaitaire égal à si droit_ouvert_complément alors - (dépassement_plafond_ressources de montant_versé_forfaitaire) *€ - (1,0 /. 12,0) + (complément_dégressif de montant_versé_forfaitaire) sinon 0 € ``` @@ -370,8 +369,8 @@ partir de onze ans et à 5,67 p. 100 à partir de seize ans. ```catala champ d'application AllocationsFamiliales : - exception base_âge_limite_alinéa_1_l521_3 - définition âge_limite_alinéa_1_l521_3 de enfant + exception decret_2008_âge_minimum_alinéa_1_l521_3 + définition âge_minimum_alinéa_1_l521_3 de enfant sous condition prestations_familiales.régime_outre_mer_l751_1 conséquence égal à 11 diff --git a/examples/allocations_familiales/securite_sociale_L.catala_fr b/examples/allocations_familiales/securite_sociale_L.catala_fr index 24648a11..6ea9e879 100644 --- a/examples/allocations_familiales/securite_sociale_L.catala_fr +++ b/examples/allocations_familiales/securite_sociale_L.catala_fr @@ -46,7 +46,8 @@ ouvre droit aux prestations familiales : ```catala champ d'application PrestationsFamiliales : règle droit_ouvert de enfant sous condition - (date_courante <=@ enfant.fin_obligation_scolaire) + enfant.obligation_scolaire sous forme Avant ou + enfant.obligation_scolaire sous forme Pendant conséquence rempli ``` @@ -55,19 +56,21 @@ tout enfant dont la rémunération éventuelle n'excède pas un plafond. ```catala champ d'application PrestationsFamiliales : + règle droit_ouvert de enfant sous condition + enfant.obligation_scolaire sous forme Après et + (enfant.rémuneration_mensuelle <=€ plafond_l512_3_2) et + (enfant.âge < âge_l512_3_2) + conséquence rempli + # On définit les conditions hors âge d'abord car elles # sont référencées plus tard dans l'article L521-1 règle conditions_hors_âge de enfant sous condition - (date_courante <=@ enfant.fin_obligation_scolaire) ou + enfant.obligation_scolaire sous forme Avant ou + enfant.obligation_scolaire sous forme Pendant ou + enfant.obligation_scolaire sous forme Après et (enfant.rémuneration_mensuelle <=€ plafond_l512_3_2) conséquence rempli - règle droit_ouvert de enfant sous condition - (date_courante >@ enfant.fin_obligation_scolaire) et - (conditions_hors_âge de enfant) et - (enfant.âge < âge_l512_3_2) - conséquence rempli - champ d'application AllocationsFamiliales: définition enfants_à_charge_droit_ouvert_prestation_familiale égal à filtre pour enfant dans enfants_à_charge de @@ -79,15 +82,9 @@ de logement mentionnés aux 3° et 4° de l'article L. 511-1 , l'âge limite peut être différent de celui mentionné au 2° du présent article. ```catala -champ d'application PrestationsFamiliales : - définition âge_l512_3_2 sous condition - (âge_l512_3_2_alternatif sous forme Présent) et - (prestation_courante = ComplémentFamilial ou - prestation_courante = AllocationLogement) - conséquence égal à - selon âge_l512_3_2_alternatif sous forme - -- Présent de âge : âge - -- Absent: 0 +# Sera géré avec une exception dans Catala. Le texte est équivalent +# à une méta-propriété du code à vérifier : i.e. pas d'exceptions pour +# cet âge azutre part que pour Complément Familial ou AllocationLogement. ``` ##### Titre 2 : Prestations générales d'entretien @@ -117,18 +114,15 @@ celles de l'âge pour l'ouverture du droit aux allocations familiales. champ d'application AllocationsFamiliales : assertion fixé montant_versé par décret - # Ici, l'ouverture du droit aux allocations familiales est conditionné - # au fait d'avoir deux enfants à charges qui répondent aux conditions - # d'ouverture du droit à une prestation familiale. Pour cette raison, - # nous nous référons ici aux conditions_hors_âge de prestations_familiales - règle conditions_hors_âge de enfant sous condition - prestations_familiales.conditions_hors_âge de enfant - conséquence rempli - règle droit_ouvert_forfaitaire de enfant sous condition - (nombre de enfants_à_charge >= nombre_enfants_l521_1) et + # nombre_enfants_alinéa_2_l521_3 sera défini dans l'article R521-3 + (nombre de enfants_à_charge >= nombre_enfants_alinéa_2_l521_3) et + # Puisqu'un enfant ne garde un âge donné que pour une période d'un an, + # cette condition assure que l'allocation ne peut être distribuée que pour + # un an. (enfant.âge = prestations_familiales.âge_l512_3_2) et - (conditions_hors_âge de enfant) + (enfant.a_déjà_ouvert_droit_aux_allocations_familiales) et + (prestations_familiales.conditions_hors_âge de enfant) conséquence rempli ``` @@ -186,9 +180,13 @@ que ce soit, la charge effective et permanente de l'enfant. ```catala champ d'application AllocationsFamiliales : - définition prise_en_compte de enfant égal à Complète + définition prise_en_compte de enfant sous condition + enfant.prise_en_charge sous forme EffectiveEtPermanente + conséquence égal à PriseEnCompte.Complète - définition versement de enfant égal à Normal + définition versement de enfant sous condition + enfant.prise_en_charge sous forme EffectiveEtPermanente + conséquence égal à VersementAllocations.Normal ``` En cas de résidence alternée de l'enfant au domicile de chacun des parents telle @@ -202,27 +200,23 @@ les conditions d'application du présent alinéa. ```catala champ d'application AllocationsFamiliales : # Premier cas : garde alternée, parents désignent un unique allocataire - exception définition prise_en_compte de enfant sous condition - enfant.garde_alternée sous forme OuiAllocataireUnique - conséquence égal à Complète + enfant.prise_en_charge sous forme GardeAlternéeAllocataireUnique + conséquence égal à PriseEnCompte.Complète - exception définition versement de enfant sous condition - enfant.garde_alternée sous forme OuiAllocataireUnique - conséquence égal à Normal + enfant.prise_en_charge sous forme GardeAlternéeAllocataireUnique + conséquence égal à VersementAllocations.Normal # Deuxième cas : garde alternée, parents partagent la charge pour # l'allocation - exception définition prise_en_compte de enfant sous condition - enfant.garde_alternée sous forme OuiPartageAllocations - conséquence égal à Partagée + enfant.prise_en_charge sous forme GardeAlternéePartageAllocations + conséquence égal à PriseEnCompte.Partagée - exception définition versement de enfant sous condition - enfant.garde_alternée sous forme OuiPartageAllocations - conséquence égal à Normal + enfant.prise_en_charge sous forme GardeAlternéePartageAllocations + conséquence égal à VersementAllocations.Normal ``` Lorsque la personne qui assume la charge effective et permanente de l'enfant ne @@ -231,7 +225,13 @@ du droit aux allocations familiales, ce droit s'ouvre du chef du père ou, à défaut, du chef de la mère. ```catala -# Non formalisé pour le calcul du montant des allocations +champ d'application AllocationsFamiliales : + assertion + personne_charge_effective_permanente_est_parent ou + ( + (non personne_charge_effective_permanente_est_parent) et + personne_charge_effective_permanente_remplit_titre_I + ) ``` Lorsqu'un enfant est confié au service d'aide sociale à l'enfance, les @@ -249,11 +249,26 @@ de l'enfant dans son foyer. ```catala champ d'application AllocationsFamiliales : - exception + définition prise_en_compte de enfant sous condition + enfant.prise_en_charge sous forme + ServicesSociauxAllocationVerséeAuxServicesSociaux + conséquence égal à PriseEnCompte.Zéro + définition versement de enfant sous condition - enfant.prise_en_charge_par_services_sociaux sous forme - OuiAllocationVerséeAuxServicesSociaux - conséquence égal à AllocationVerséeAuxServicesSociaux + enfant.prise_en_charge sous forme + ServicesSociauxAllocationVerséeAuxServicesSociaux + conséquence égal à VersementAllocations.AllocationVerséeAuxServicesSociaux + + définition prise_en_compte de enfant sous condition + enfant.prise_en_charge sous forme + ServicesSociauxAllocationVerséeÀLaFamille + conséquence égal à PriseEnCompte.Complète + + + définition versement de enfant sous condition + enfant.prise_en_charge sous forme + ServicesSociauxAllocationVerséeÀLaFamille + conséquence égal à VersementAllocations.Normal ``` Un décret en Conseil d'Etat fixe les conditions d'application du présent @@ -282,7 +297,7 @@ champ d'application AllocationsFamiliales : règle droit_ouvert_majoration de enfant sous condition (non (est_enfant_le_plus_âgé de enfant)) et - (enfant.âge >= âge_limite_alinéa_1_l521_3 de enfant) + (enfant.âge >= âge_minimum_alinéa_1_l521_3 de enfant) conséquence rempli ``` @@ -297,7 +312,7 @@ champ d'application AllocationsFamiliales : sous condition (nombre de enfants_à_charge_droit_ouvert_prestation_familiale >= nombre_enfants_alinéa_2_l521_3) et - (enfant.âge >= âge_limite_alinéa_1_l521_3 de enfant) + (enfant.âge >= âge_minimum_alinéa_1_l521_3 de enfant) conséquence rempli ``` @@ -331,6 +346,9 @@ l'ensemble des bénéficiaires de la législation générale de sécurité sociale, y compris les membres des professions agricoles. ```catala +# Angle mort: ici nous n'avons pas formalisé la partie sur la législation +# générale de sécurité sociale et les membres des professions agricoles. + champ d'application PrestationsFamiliales : règle régime_outre_mer_l751_1 sous condition (résidence = Guadeloupe) ou @@ -376,6 +394,12 @@ Les allocations familiales sont dues, pour tout enfant, à la personne qui a effectivement la charge de celui-ci. ```catala +# Angle mort: ici c'est marqué "effectivement la charge" mais dans l'article de +# L521-2 il faut charge effective ET permanente. Pourquoi cette différence ? +# Quelles conséquences pratiques ? +# Apparemment en 1987 il y avait encore des exceptions pour certains agents +# publics d'outre-mer + champ d'application AllocationsFamiliales: exception règle droit_ouvert_base sous condition diff --git a/examples/allocations_familiales/securite_sociale_R.catala_fr b/examples/allocations_familiales/securite_sociale_R.catala_fr index f5c2bc1e..d57f3716 100644 --- a/examples/allocations_familiales/securite_sociale_R.catala_fr +++ b/examples/allocations_familiales/securite_sociale_R.catala_fr @@ -48,8 +48,8 @@ enfants ouvrent droit à la majoration des allocations familiales est fixé à ```catala champ d'application AllocationsFamiliales : - étiquette base_âge_limite_alinéa_1_l521_3 - définition âge_limite_alinéa_1_l521_3 de enfant égal à 14 + étiquette cas_base_âge_minimum_alinéa_1_l521_3 + définition âge_minimum_alinéa_1_l521_3 de enfant égal à 14 ``` Le nombre minimum d'enfants à charge, mentionné au deuxième alinéa de l'article @@ -71,13 +71,15 @@ le onzième anniversaire est postérieur au 30 avril 2008. # du décret de 2008 pour des raisons de place seulement. champ d'application AllocationFamilialesAvril2008: # Âge limite avant décret n° 2008-409 du 28 avril 2008 - définition âge_limite_alinéa_1_l521_3 égal à 16 + définition âge_minimum_alinéa_1_l521_3 égal à 16 champ d'application AllocationsFamiliales : - définition âge_limite_alinéa_1_l521_3 de enfant - sous condition (enfant.date_de_naissance +@ 11 an <=@ |30/04/2008|) + étiquette decret_2008_âge_minimum_alinéa_1_l521_3 + exception cas_base_âge_minimum_alinéa_1_l521_3 + définition âge_minimum_alinéa_1_l521_3 de enfant + sous condition (enfant.date_de_naissance +@ 11 an <=@ |2008-04-30|) conséquence égal à - version_avril_2008.âge_limite_alinéa_1_l521_3 + version_avril_2008.âge_minimum_alinéa_1_l521_3 ``` #### [Article R521-2|LEGIARTI000006750608] @@ -141,6 +143,10 @@ champ d'application AllocationsFamiliales : selon (prise_en_compte de enfant) sous forme -- Complète : 1,0 -- Partagée : 0,5 + # Pas directement dans cet arricle de loi, mais concerne le + # cas où l'enfant est pris en charge par les services sociaux et + # la part de l'allocation va également au service social + -- Zéro: 0,0 ) ``` @@ -177,6 +183,10 @@ champ d'application AllocationsFamiliales : selon (prise_en_compte de enfant) sous forme -- Complète : 100% -- Partagée : 50% + # Pas directement dans cet arricle de loi, mais concerne le + # cas où l'enfant est pris en charge par les services sociaux et + # la part de l'allocation va également au service social + -- Zéro: 0% ) ``` diff --git a/examples/allocations_familiales/tests/tests_allocations_familiales.catala_fr b/examples/allocations_familiales/tests/tests_allocations_familiales.catala_fr index a677f96d..5a7b3a9d 100644 --- a/examples/allocations_familiales/tests/tests_allocations_familiales.catala_fr +++ b/examples/allocations_familiales/tests/tests_allocations_familiales.catala_fr @@ -15,38 +15,38 @@ déclaration champ d'application Données: champ d'application Données: définition enfant1 égal à EnfantEntrée { -- d_identifiant: 1 - -- d_date_de_naissance: |01/01/2007| + -- d_date_de_naissance: |2007-01-01| -- d_rémuneration_mensuelle: 0€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant2 égal à EnfantEntrée { -- d_identifiant: 2 - -- d_date_de_naissance: |01/01/2009| + -- d_date_de_naissance: |2009-01-01| -- d_rémuneration_mensuelle: 0€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant3 égal à EnfantEntrée { -- d_identifiant: 3 - -- d_date_de_naissance: |01/01/2003| + -- d_date_de_naissance: |2003-01-01| -- d_rémuneration_mensuelle: 400€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: OuiPartageAllocations + -- d_prise_en_charge: GardeAlternéePartageAllocations + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant4 égal à EnfantEntrée { -- d_identifiant: 4 - -- d_date_de_naissance: |01/01/2001| + -- d_date_de_naissance: |2001-01-01| -- d_rémuneration_mensuelle: 1100€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant5 égal à EnfantEntrée { -- d_identifiant: 5 - -- d_date_de_naissance: |01/01/2000| + -- d_date_de_naissance: |2000-01-01| -- d_rémuneration_mensuelle: 0€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai } déclaration champ d'application Test1: @@ -57,8 +57,9 @@ champ d'application Test1: définition f.enfants égal à [données.enfant1;données.enfant2;données.enfant3;données.enfant4] définition f.ressources_ménage égal à 30 000 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 351,26€ déclaration champ d'application Test2: @@ -69,8 +70,9 @@ champ d'application Test2: définition f.enfants égal à [données.enfant1;données.enfant2;données.enfant5] définition f.ressources_ménage égal à 30 000 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 216,27€ @@ -81,8 +83,9 @@ déclaration champ d'application Test3: champ d'application Test3: définition f.enfants égal à [données.enfant1] définition f.ressources_ménage égal à 63540 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Guyane + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 12,18€ déclaration champ d'application Test4: @@ -92,8 +95,9 @@ déclaration champ d'application Test4: champ d'application Test4: définition f.enfants égal à [données.enfant1; données.enfant3] définition f.ressources_ménage égal à 67 250 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 99,37€ déclaration champ d'application Test5: @@ -103,8 +107,9 @@ déclaration champ d'application Test5: champ d'application Test5: définition f.enfants égal à [données.enfant1] définition f.ressources_ménage égal à 30 000 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 0,00€ déclaration champ d'application Test6: @@ -113,21 +118,22 @@ déclaration champ d'application Test6: champ d'application Test6: définition f.enfants égal à [EnfantEntrée { -- d_identifiant: 0 - -- d_date_de_naissance: |10/11/2009| + -- d_date_de_naissance: |2009-11-10| -- d_rémuneration_mensuelle: 439€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai };EnfantEntrée { -- d_identifiant: 1 - -- d_date_de_naissance: |25/09/2020| + -- d_date_de_naissance: |2020-09-25| -- d_rémuneration_mensuelle: 1949€ - -- d_prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- d_garde_alternée: NonGardeUnique + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai }] définition f.ressources_ménage égal à 78 830 € - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.résidence égal à Guadeloupe - assertion f.montant_versé = 132,49€ + règle f.personne_charge_effective_permanente_est_parent rempli + assertion f.montant_versé = 66,25€ déclaration champ d'application Test7: contexte f champ d'application InterfaceAllocationsFamiliales @@ -137,9 +143,33 @@ champ d'application Test7: définition f.enfants égal à [données.enfant1;données.enfant2;données.enfant3;données.enfant4] définition f.ressources_ménage égal à 30 000 € - définition f.date_courante égal à |01/02/2021| + définition f.date_courante égal à |2021-02-01| définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli assertion f.montant_versé = 417,51€ +déclaration champ d'application Test8: + contexte f champ d'application InterfaceAllocationsFamiliales + +champ d'application Test8: + définition f.enfants égal à [EnfantEntrée { + -- d_identifiant: 0 + -- d_date_de_naissance: |2004-01-01| + -- d_rémuneration_mensuelle: 0€ + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai + };EnfantEntrée { + -- d_identifiant: 1 + -- d_date_de_naissance: |2005-01-01| + -- d_rémuneration_mensuelle: 0€ + -- d_prise_en_charge: EffectiveEtPermanente + -- d_a_déjà_ouvert_droit_aux_allocations_familiales: vrai + }] + définition f.ressources_ménage égal à 69945 € + définition f.date_courante égal à |2021-01-01| + définition f.résidence égal à Métropole + règle f.personne_charge_effective_permanente_est_parent rempli + assertion f.montant_versé = 197,74€ + ``` diff --git a/examples/allocations_familiales/tests/tests_ouverture_droits.catala_fr b/examples/allocations_familiales/tests/tests_ouverture_droits.catala_fr index 3929b252..e950cae2 100644 --- a/examples/allocations_familiales/tests/tests_ouverture_droits.catala_fr +++ b/examples/allocations_familiales/tests/tests_ouverture_droits.catala_fr @@ -14,39 +14,39 @@ déclaration champ d'application Données: champ d'application Données: définition enfant1 égal à Enfant { -- identifiant: 1 - -- fin_obligation_scolaire : |01/08/2023| - -- date_de_naissance: |01/01/2007| + -- obligation_scolaire : Pendant + -- date_de_naissance: |2007-01-01| -- âge: 13 -- rémuneration_mensuelle: 0€ - -- prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- garde_alternée: NonGardeUnique + -- prise_en_charge: EffectiveEtPermanente + -- a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant2 égal à Enfant { -- identifiant: 2 - -- fin_obligation_scolaire : |01/08/2019| - -- date_de_naissance: |01/01/2003| + -- obligation_scolaire : Après + -- date_de_naissance: |2003-01-01| -- âge: 18 -- rémuneration_mensuelle: 1000€ - -- prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- garde_alternée: NonGardeUnique + -- prise_en_charge: EffectiveEtPermanente + -- a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant3 égal à Enfant { -- identifiant: 3 - -- fin_obligation_scolaire : |01/08/2019| - -- date_de_naissance: |01/01/2003| + -- obligation_scolaire : Après + -- date_de_naissance: |2003-01-01| -- âge: 18 -- rémuneration_mensuelle: 400€ - -- prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- garde_alternée: NonGardeUnique + -- prise_en_charge: EffectiveEtPermanente + -- a_déjà_ouvert_droit_aux_allocations_familiales: vrai } définition enfant4 égal à Enfant { -- identifiant: 4 - -- fin_obligation_scolaire : |01/08/2016| - -- date_de_naissance: |01/01/1999| + -- obligation_scolaire : Après + -- date_de_naissance: |1999-01-01| -- âge: 21 -- rémuneration_mensuelle: 0€ - -- prise_en_charge_par_services_sociaux: NonPriseEnChargeFamille - -- garde_alternée: NonGardeUnique + -- prise_en_charge: EffectiveEtPermanente + -- a_déjà_ouvert_droit_aux_allocations_familiales: vrai } déclaration champ d'application Test1: @@ -54,8 +54,7 @@ déclaration champ d'application Test1: contexte f champ d'application PrestationsFamiliales champ d'application Test1: - définition f.âge_l512_3_2_alternatif égal à Absent - définition f.date_courante égal à |01/05/2020| + définition f.date_courante égal à |2020-05-01| définition f.prestation_courante égal à AllocationsFamiliales définition f.résidence égal à Métropole assertion (f.droit_ouvert de données.enfant1) diff --git a/examples/hawaii_lfo/Makefile b/examples/hawaii_lfo/Makefile new file mode 100644 index 00000000..b7c7ce2c --- /dev/null +++ b/examples/hawaii_lfo/Makefile @@ -0,0 +1,4 @@ +CATALA_LANG=en +SRC=Title17-MotorAndOtherVehicles.catala_en + +include ../Makefile.common.mk diff --git a/examples/hawaii_lfo/Title17-MotorAndOtherVehicles.catala_en b/examples/hawaii_lfo/Title17-MotorAndOtherVehicles.catala_en new file mode 100644 index 00000000..c9d9d6fd --- /dev/null +++ b/examples/hawaii_lfo/Title17-MotorAndOtherVehicles.catala_en @@ -0,0 +1,164 @@ +## Title17 + +> Begin metadata + +```catala +declaration enumeration Violation_83_135: + -- Section286_102 + -- Section286_122 + -- Section286_130 + -- Section286_131 + -- Section286_132 + -- Section286_133 + -- Section286_134 + -- Other_83_135 + +declaration structure Offense: + data date_of content date + data violation content Violation_83_135 + +declaration scope Defendant: + context priors content collection Offense + # Only a number of years... + context age content integer + +declaration scope Penalty286_83_135: + + # Inputs: + + context fine content money + context days content duration + context loses_right_to_drive_until_18 condition + context offense content Offense + context defendant scope Defendant + + # Internal: + + context priors_same_offense content integer + + context max_fine content money + context min_fine content money + context max_days content duration + + context paragraph_a_applies condition + context paragraph_b_applies condition + context paragraph_c_applies condition + + context fine_ok condition + context days_ok condition + + # Outcomes: + + context ok condition +``` +> End metadata + +## [286-136 Penalty] + +```catala +scope Penalty286_83_135: + + rule fine_ok under condition min_fine <=$ fine and fine <=$ max_fine + consequence fulfilled + + rule days_ok under condition days <=^ max_days + consequence fulfilled + + rule ok under condition fine_ok and days_ok + consequence fulfilled +``` + +§(a) Except as provided in subsection (b), any person who +violates section 286-102, 286-122, 286-130, 286-131, 286-132, 286-133, or +286-134 shall be fined not more than $1,000 or imprisoned not more than thirty +days, or both. Any person who violates any other section in this part shall be +fined not more than $1,000. + +```catala +scope Penalty286_83_135: + + rule paragraph_a_applies under condition + (not paragraph_b_applies) and + (not paragraph_c_applies) + consequence fulfilled + + definition min_fine under condition + paragraph_a_applies + consequence equals $0 + + definition max_fine equals $1000 + + label max_days_a + definition max_days under condition + paragraph_a_applies + consequence equals 0 day + + exception max_days_a definition max_days under condition + paragraph_a_applies and + offense.violation with pattern Section286_102 or + offense.violation with pattern Section286_122 or + offense.violation with pattern Section286_130 or + offense.violation with pattern Section286_131 or + offense.violation with pattern Section286_132 or + offense.violation with pattern Section286_133 or + offense.violation with pattern Section286_134 + consequence equals 30 day +``` + +(b) Any person who is convicted of violating section 286-102, 286-122, 286-130, +286-131, 286-132, 286-133, or 286-134 shall be subject to a minimum fine of $500 +and a maximum fine of $1,000, or imprisoned not more than one year, or both, if +the person has two or more prior convictions for the same offense in the +preceding five-year period. + +```catala +scope Penalty286_83_135: + + # Under subsection (b) (1996), it is the date the defendant committed the current + # offense for which he or she is being prosecuted that is used to determine + # whether the defendant has two or more prior convictions for the same offense in + # the preceding five-year period. 118 H. 259 (App.), 188 P.3d 773 (2008). + + # TODO: need to figure out how years are defined + definition priors_same_offense equals + number for prior in defendant.priors of ( + prior.violation = offense.violation and + prior.date_of +@ 5 year <=@ offense.date_of + ) + + rule paragraph_b_applies under condition + (not (offense.violation with pattern Other_83_135)) and + priors_same_offense >= 2 and + not paragraph_c_applies + consequence fulfilled + + definition min_fine under condition + paragraph_b_applies + consequence equals $500 + + definition max_days under condition + paragraph_b_applies + consequence equals 1 year +``` + +(c) Notwithstanding subsections (a) and (b), a minor under the age of eighteen +under the jurisdiction of the family court who is subject to this section shall +either lose the right to drive a motor vehicle until the age of eighteen or be +subject to a fine of $500. [L 1967, c 214, pt of §2; HRS §286-136; am L 1993, c +214, §7; am L 1996, c 169, §3; am L 2003, c 69, §5] + +```catala +scope Penalty286_83_135: + + rule paragraph_c_applies under condition + # TODO: check what happens if the offense is committed on the day of the + # birthday + defendant.age < 18 # and minor and under the jurisdiction etc. + consequence fulfilled + + # TODO: use a boolean xor + exception definition fine_ok under condition paragraph_c_applies + # TODO: = and != are usually left-associative + consequence equals ((fine = $500) != loses_right_to_drive_until_18) + +``` diff --git a/examples/us_tax_code/section_1015.catala_en b/examples/us_tax_code/section_1015.catala_en index 40178c1d..f2739723 100644 --- a/examples/us_tax_code/section_1015.catala_en +++ b/examples/us_tax_code/section_1015.catala_en @@ -51,7 +51,7 @@ scope BasisOfGift: transferor.basis definition basis under condition - acquisition.moment > |12/31/1920| and + acquisition.moment > |1920-12-31| and acquisition.method = Gift consequence equals basis_subsection_a ``` @@ -68,7 +68,7 @@ scope BasisOfGift: ```catala scope BasisOfGift under condition - acquisition.moment > |01/31/1920| and + acquisition.moment > |1920-01-31| and acquisition.method = Gift: definition transferor.basis equals @@ -88,7 +88,7 @@ made. ```catala scope BasisOfGift under condition - acquisition.moment > |01/31/1920| and + acquisition.moment > |1920-01-31| and acquisition.method = Trust: definition basis equals @@ -102,7 +102,7 @@ If the property was acquired by gift or transfer in trust on or before December of such acquisition. ```catala -scope BasisOfGift under condition acquisition.moment <= |01/31/1920|: +scope BasisOfGift under condition acquisition.moment <= |1920-01-31|: definition basis equals value.fair_market of acquisition.moment ``` @@ -117,7 +117,7 @@ amount of gift tax paid with respect to such gift, or ```catala scope BasisOfGift under condition - acquisition.moment >= |09/02/1958| and + acquisition.moment >= |1958-09-02| and acquisition.method = Gift: definition basis equals @@ -139,7 +139,7 @@ gift. ```catala scope BasisOfGift under condition - acquisition.moment < |09/02/1958| and + acquisition.moment < |1958-09-02| and acquisition.method = Gift and acquisition.no_sale_or_exchange_before: @@ -222,7 +222,7 @@ bears the same ratio to the amount of tax so paid as— ```catala scope BasisOfGift under condition - acquisition.moment > |09/02/1976| and + acquisition.moment > |1976-09-02| and acquisition.method = Gift: definition basis_bonus_after_1976 equals diff --git a/examples/us_tax_code/tests/test_section_121.catala_en b/examples/us_tax_code/tests/test_section_121.catala_en index 57964e87..ef763b9b 100644 --- a/examples/us_tax_code/tests/test_section_121.catala_en +++ b/examples/us_tax_code/tests/test_section_121.catala_en @@ -16,20 +16,20 @@ declaration scope Data: context person_ko_2 content PersonalData scope Data: - definition date_of_sale_or_exchange equals |01/01/2021| - definition return_date equals |01/01/2021| + definition date_of_sale_or_exchange equals |2021-01-01| + definition return_date equals |2021-01-01| definition gain_from_sale_or_exchange_of_property equals $350,000 definition period_four_years_recent equals Period { - -- begin: |01/01/2017| - -- end: |01/01/2021| + -- begin: |2017-01-01| + -- end: |2021-01-01| } definition period_one_year_recent equals Period { - -- begin: |01/01/2019| - -- end: |01/01/2020| + -- begin: |2019-01-01| + -- end: |2020-01-01| } definition period_two_years_middle equals Period { - -- begin: |01/01/2015| - -- end: |01/02/2017| + -- begin: |2015-01-01| + -- end: |2017-01-02| } definition person_ok_1 equals PersonalData { -- property_ownage: [period_four_years_recent] diff --git a/javascript/.gitignore b/french_law_js/.gitignore similarity index 100% rename from javascript/.gitignore rename to french_law_js/.gitignore diff --git a/french_law_js/README.md b/french_law_js/README.md new file mode 100644 index 00000000..c03e57f5 --- /dev/null +++ b/french_law_js/README.md @@ -0,0 +1,52 @@ +# The French Law Javascript Library + +This Javascript library contains some computations defined by French +legislative texts. The JS code is extracted from OCaml, which is itself +extracted from Catala code (https://catala-lang.org). + +## Allocations familiales + +The function of the library is `computeAllocationsFamiliales`. This computation +returns the amount of _allocations familiales_ for one household described +by the input. More precisely, the result returned is the sum of: + +- _la base des allocations familiales_ +- _l'allocation forfaitaire relai pour dépassement de l'âge limite_ +- _la majoration pour âge_ +- _le complément dégressif en cas de dépassement du plafond de revenus_ + +An example of use: + +```javascript +Law.computeAllocationsFamiliales({ + currentDate: new Date("2020-05-20"), + children: [ + { + id: 0, + remunerationMensuelle: 0, + dateNaissance: new Date("2003-03-02"), + priseEnCharge: "Effective et permanente", + aDejaOuvertDroitAuxAllocationsFamiliales: true, + }, + { + id: 1, + remunerationMensuelle: 300, + dateNaissance: new Date("2013-10-30"), + priseEnCharge: "Garde alternée, partage des allocations", + aDejaOuvertDroitAuxAllocationsFamiliales: true, + }, + ], + income: 30000, + residence: "Métropole", + personneQuiAssumeLaChargeEffectivePermanenteEstParent: true, + personneQuiAssumeLaChargeEffectivePermanenteRemplitConditionsTitreISecuriteSociale: true, +}); +``` + +Notably, the `priseEnCharge` variable for each child expects a value among: + +- `"Effective et permanente"` +- `"Garde alternée, allocataire unique"` +- `"Garde alternée, partage des allocations"` +- `"Confié aux service sociaux, allocation versée à la famille"` +- `"Confié aux service sociaux, allocation versée aux services sociaux"` diff --git a/javascript/allocations_familiales.js b/french_law_js/allocations_familiales.js similarity index 63% rename from javascript/allocations_familiales.js rename to french_law_js/allocations_familiales.js index 5e1b0c13..bc3dca9c 100644 --- a/javascript/allocations_familiales.js +++ b/french_law_js/allocations_familiales.js @@ -11,26 +11,24 @@ suite id: 0, remunerationMensuelle: 0, dateNaissance: new Date("2003-03-02"), - gardeAlternee: false, - priseEnChargeServiceSociaux: false, + priseEnCharge: "Effective et permanente", + aDejaOuvertDroitAuxAllocationsFamiliales: true, }, { id: 1, remunerationMensuelle: 300, dateNaissance: new Date("2013-10-30"), - gardeAlternee: true, - gardeAlterneePartageAllocation: true, - priseEnChargeServiceSociaux: false, + priseEnCharge: "Garde alternée, partage des allocations", + aDejaOuvertDroitAuxAllocationsFamiliales: true, }, ], income: 30000, residence: "Métropole", + personneQuiAssumeLaChargeEffectivePermanenteEstParent: true, + personneQuiAssumeLaChargeEffectivePermanenteRemplitConditionsTitreISecuriteSociale: true, }); }) .on("cycle", function (event) { console.log(String(event.target)); }) - .on("complete", function () { - console.log("Fastest is " + this.filter("fastest").map("name")); - }) .run({ async: true }); diff --git a/french_law_js/french_law.js b/french_law_js/french_law.js new file mode 100644 index 00000000..c8627cbf --- /dev/null +++ b/french_law_js/french_law.js @@ -0,0 +1,4000 @@ +// Generated by js_of_ocaml 3.8.0 +(function(n){"use strict";var +cd=1582,gd="src/time_Zone.ml",gP=1e14,gw="Invalid_argument",gx=" is too large for shifting.",gv="0.08",cW="Map.bal",d5=1255,ed="<",bx=255,gO=0x800,gu="577500",b8=2019,d4="jsError",aF=0x8000,gt="%ni",cc=146097,g5=43200.,bA=256,ea="ml_z_overflow",gN=0.012,C=86400.,gc="End_of_file",aH=2020,gb="Failure",am=0xff,gs=-45,el=-12,g4="559500",ek=122,gr="582700",g3=992015837,q="0",ec=0xf,ej="0.5",ce=128,cS=-48,ga=0xdc00,gq="Sys_blocked_io",g2="fd ",d$="0.0588",w=248,P="camlinternalFormat.ml",gM="Division_by_zero",c6=">",bC=153,g1=1027,f$="Sys_error",gL="x",d_=246,aT=60.,gp="%u",gK="%d",go=3268,f_=32082,bd=1900,gJ="buffer.ml",g0="_bigarray",aG="2",d9=127,b9=1024,ai="1",c5="e",cR=120,d3=103,gn=" : flags Open_rdonly and Open_wronly are not compatible",c1=127686388,f9="16",gI=102,gZ="([^/]*)",d2=512,X="-",f8=0x7ff0,bb=803994948,gm=" : file already exists",gH=101,aX=0xffffff,f7="0x",gY=-43,c4=86400,gX="Out_of_memory",bl=1e7,gW="inf",cb=254,ei="index out of bounds",at=100,eh="_bigarr02",f6="%Li",gG=" : flags Open_text and Open_binary are not compatible",ca="3",gV=0xffffffff,gF="169.",gl=2147483647,bc=0.5,aJ=0xffff,c3=417088404,f5="str.ml",gk=12520,gU=400,gj=-46,ac=3600,cQ="_z",gD="Unix.Unix_error",gE="computeAllocationsFamiliales",gC="0.55",gT="infinity",ar=1000,i="",gB="Stack_overflow",d8="^",ba=3600.,gi=86400000,by=0x3f,gA="Not_found",eg=124,b$=1461,gh="Match_failure",f3=32044,f4=", ",c0="1.",f2="static/",aW=2021,ef=252,aY=".",aV="+",gz=2440588,gS=0xf0,f1="src/date.ml",bB="12.",gg="%li",gy=1026,c2=365,cZ="Invalid integer: ",cY=2440587.5,ee=-32,aS=" ",as=0x80,aI=1023,f0="Undefined_recursive_module",cV=2299161,d7="nan",gR=969837588,cX="src/calendar_builder.ml",gf=0xe0,ge=0xdfff,aU="/",eb="compare: functional value",gQ="Assert_failure",fZ="0.16",cU=2400000.5,b_="0.",fY="%i",d6=1073741823,bz=529348384,cT=250;function +sr(d,b,e,c,f){if(c<=b)for(var +a=1;a<=f;a++)e[c+a]=d[b+a];else +for(var +a=f;a>=1;a--)e[c+a]=d[b+a];return 0}function +su(e,f,d){var +a=new +Array(d+1);a[0]=0;for(var +b=1,c=f+1;b<=d;b++,c++)a[b]=e[c];return a}function +dc(c,b,a){var +d=String.fromCharCode;if(b==0&&a<=4096&&a==c.length)return d.apply(null,c);var +e=i;for(;0=b.l||b.t==2&&c>=b.c.length)){b.c=d.t==4?dc(d.c,e,c):e==0&&d.c.length==c?d.c:d.c.substr(e,c);b.t=b.c.length==b.l?0:2}else +if(b.t==2&&f==b.c.length){b.c+=d.t==4?dc(d.c,e,c):e==0&&d.c.length==c?d.c:d.c.substr(e,c);b.t=b.c.length==b.l?0:2}else{if(b.t!=4)c7(b);var +g=d.c,h=b.c;if(d.t==4)if(f<=e)for(var +a=0;a=0;a--)h[f+a]=g[e+a];else{var +i=Math.min(c,g.length-e);for(var +a=0;a>=1;if(b==0)return d;a+=a;c++;if(c==9)a.slice(0,1)}}function +bi(a){if(a.t==2)a.c+=bI(a.l-a.c.length,"\0");else +a.c=dc(a.c,0,a.c.length);a.t=0}function +hd(a,b){if(a===b)return 1;a.t&6&&bi(a);b.t&6&&bi(b);return a.c==b.c?1:0}function +tc(b,a){throw[0,b,a]}function +hw(a){if(a.length<24){for(var +b=0;bd9)return false;return true}else +return!/[^\x00-\x7f]/.test(a)}function +eC(e){for(var +k=i,c=i,g,f,h,a,b=0,j=e.length;bd2){c.substr(0,1);k+=c;c=i;k+=e.slice(b,d)}else +c+=e.slice(b,d);if(d==j)break;b=d}a=1;if(++b=0xd7ff&&a<0xe000)a=2}else{a=3;if(++b0x10ffff)a=3}}}}}if(a<4){b-=a;c+="\ufffd"}else +if(a>aJ)c+=String.fromCharCode(0xd7c0+(a>>10),ga+(a&0x3FF));else +c+=String.fromCharCode(a);if(c.length>b9){c.substr(0,1);k+=c;c=i}}return k+c}function +aZ(c,a,b){this.t=c;this.c=a;this.l=b}aZ.prototype.toString=function(){switch(this.t){case +9:return this.c;default:bi(this);case +0:if(hw(this.c)){this.t=9;return this.c}this.t=8;case +8:return this.c}};aZ.prototype.toUtf16=function(){var +a=this.toString();if(this.t==9)return a;return eC(a)};aZ.prototype.slice=function(){var +a=this.t==4?this.c.slice():this.c;return new +aZ(this.t,a,this.l)};function +he(a){return new +aZ(0,a,a.length)}function +a(a){return he(a)}function +ez(c,b){tc(c,a(b))}var +H=[0];function +I(a){ez(H.Invalid_argument,a)}function +hb(){I(ei)}function +cg(a,b){switch(a.t&6){default:if(b>=a.c.length)return 0;case +0:return a.c.charCodeAt(b);case +4:return a.c[b]}}function +bh(b,a){if(a>>>0>=b.l)hb();return cg(b,a)}function +F(a,c,b){b&=am;if(a.t!=4){if(c==a.c.length){a.c+=String.fromCharCode(b);if(c+1==a.l)a.t=0;return 0}c7(a)}a.c[c]=b;return 0}function +av(b,a,c){if(a>>>0>=b.l)hb();return F(b,a,c)}function +a1(c,a){if(c.fun)return a1(c.fun,a);if(typeof +c!=="function")return c;var +b=c.length|0;if(b===0)return c.apply(null,a);var +e=a.length|0,d=b-e|0;if(d==0)return c.apply(null,a);else +if(d<0)return a1(c.apply(null,a.slice(0,b)),a.slice(b));else +return function(){var +e=arguments.length==0?1:arguments.length,d=new +Array(a.length+e);for(var +b=0;b>>0>=a.length-1)cf();return a}function +sz(a){if(isFinite(a)){if(Math.abs(a)>=2.2250738585072014e-308)return 0;if(a!=0)return 1;return 2}return isNaN(a)?4:3}function +az(a){if((a.t&6)!=0)bi(a);return a.c}var +tt=Math.log2&&Math.log2(1.1235582092889474E+307)==1020;function +tr(a){if(tt)return Math.floor(Math.log2(a));var +b=0;if(a==0)return-Infinity;if(a>=1)while(a>=2){a/=2;b++}else +while(a<1){a*=2;b--}return b}function +er(c){var +a=new(n.Float32Array)(1);a[0]=c;var +b=new(n.Int32Array)(a.buffer);return b[0]|0}var +hm=Math.pow(2,-24);function +db(a){throw a}function +bG(){db(H.Division_by_zero)}function +j(b,c,a){this.lo=b&aX;this.mi=c&aX;this.hi=a&aJ}j.prototype.caml_custom="_j";j.prototype.copy=function(){return new +j(this.lo,this.mi,this.hi)};j.prototype.ucompare=function(a){if(this.hi>a.hi)return 1;if(this.hia.mi)return 1;if(this.mia.lo)return 1;if(this.loc)return 1;if(ba.mi)return 1;if(this.mia.lo)return 1;if(this.lo>24),c=-this.hi+(b>>24);return new +j(a,b,c)};j.prototype.add=function(a){var +b=this.lo+a.lo,c=this.mi+a.mi+(b>>24),d=this.hi+a.hi+(c>>24);return new +j(b,c,d)};j.prototype.sub=function(a){var +b=this.lo-a.lo,c=this.mi-a.mi+(b>>24),d=this.hi-a.hi+(c>>24);return new +j(b,c,d)};j.prototype.mul=function(a){var +b=this.lo*a.lo,c=(b*hm|0)+this.mi*a.lo+this.lo*a.mi,d=(c*hm|0)+this.hi*a.lo+this.mi*a.mi+this.lo*a.hi;return new +j(b,c,d)};j.prototype.isZero=function(){return(this.lo|this.mi|this.hi)==0};j.prototype.isNeg=function(){return this.hi<<16<0};j.prototype.and=function(a){return new +j(this.lo&a.lo,this.mi&a.mi,this.hi&a.hi)};j.prototype.or=function(a){return new +j(this.lo|a.lo,this.mi|a.mi,this.hi|a.hi)};j.prototype.xor=function(a){return new +j(this.lo^a.lo,this.mi^a.mi,this.hi^a.hi)};j.prototype.shift_left=function(a){a=a&63;if(a==0)return this;if(a<24)return new +j(this.lo<>24-a,this.hi<>24-a);if(a<48)return new +j(0,this.lo<>48-a);return new +j(0,0,this.lo<>a|this.mi<<24-a,this.mi>>a|this.hi<<24-a,this.hi>>a);if(a<48)return new +j(this.mi>>a-24|this.hi<<48-a,this.hi>>a-24,0);return new +j(this.hi>>a-48,0,0)};j.prototype.shift_right=function(a){a=a&63;if(a==0)return this;var +c=this.hi<<16>>16;if(a<24)return new +j(this.lo>>a|this.mi<<24-a,this.mi>>a|c<<24-a,this.hi<<16>>a>>>16);var +b=this.hi<<16>>31;if(a<48)return new +j(this.mi>>a-24|this.hi<<48-a,this.hi<<16>>a-24>>16,b&aJ);return new +j(this.hi<<16>>a-32,b,b)};j.prototype.lsl1=function(){this.hi=this.hi<<1|this.mi>>23;this.mi=(this.mi<<1|this.lo>>23)&aX;this.lo=this.lo<<1&aX};j.prototype.lsr1=function(){this.lo=(this.lo>>>1|this.mi<<23)&aX;this.mi=(this.mi>>>1|this.hi<<23)&aX;this.hi=this.hi>>>1};j.prototype.udivmod=function(e){var +c=0,b=this.copy(),a=e.copy(),d=new +j(0,0,0);while(b.ucompare(a)>0){c++;a.lsl1()}while(c>=0){c--;d.lsl1();if(b.ucompare(a)>=0){d.lo++;b=b.sub(a)}a.lsr1()}return{quotient:d,modulus:b}};j.prototype.div=function(a){var +b=this;if(a.isZero())bG();var +d=b.hi^a.hi;if(b.hi&aF)b=b.neg();if(a.hi&aF)a=a.neg();var +c=b.udivmod(a).quotient;if(d&aF)c=c.neg();return c};j.prototype.mod=function(b){var +a=this;if(b.isZero())bG();var +d=a.hi;if(a.hi&aF)a=a.neg();if(b.hi&aF)b=b.neg();var +c=a.udivmod(b).modulus;if(d&aF)c=c.neg();return c};j.prototype.toInt=function(){return this.lo|this.mi<<24};j.prototype.toFloat=function(){return(this.hi<<16)*Math.pow(2,32)+this.mi*Math.pow(2,24)+this.lo};j.prototype.toArray=function(){return[this.hi>>8,this.hi&am,this.mi>>16,this.mi>>8&am,this.mi&am,this.lo>>16,this.lo>>8&am,this.lo&am]};j.prototype.lo32=function(){return this.lo|(this.mi&am)<<24};j.prototype.hi32=function(){return this.mi>>>8&aJ|this.hi<<16};function +ci(b,c,a){return new +j(b,c,a)}function +c9(a){if(!isFinite(a)){if(isNaN(a))return ci(1,0,f8);return a>0?ci(0,0,f8):ci(0,0,0xfff0)}var +f=a==0&&1/a==-Infinity?aF:a>=0?0:aF;if(f)a=-a;var +b=tr(a)+aI;if(b<=0){b=0;a/=Math.pow(2,-gy)}else{a/=Math.pow(2,b-g1);if(a<16){a*=2;b-=1}if(b==0)a/=2}var +d=Math.pow(2,24),c=a|0;a=(a-c)*d;var +e=a|0;a=(a-e)*d;var +g=a|0;c=c&ec|f|b<<4;return ci(g,e,c)}function +ck(a){return a.toArray()}function +ha(c,b,g){c.write(32,b.dims.length);c.write(32,b.kind|b.layout<<8);if(b.caml_custom==eh)for(var +a=0;a>4;if(c==2047)return(f|g|b&ec)==0?b&aF?-Infinity:Infinity:NaN;var +e=Math.pow(2,-24),a=(f*e+g)*e+(b&ec);if(c>0){a+=16;a*=Math.pow(2,c-g1)}else +a*=Math.pow(2,-gy);if(b&aF)a=-a;return a}function +em(b){var +d=b.length,c=1;for(var +a=0;a>>24&am|(a&aJ)<<8,a>>>16&aJ)}function +eu(a){return a.hi32()}function +ev(a){return a.lo32()}var +sw=g0;function +be(c,d,b,a){this.kind=c;this.layout=d;this.dims=b;this.data=a}be.prototype.caml_custom=sw;be.prototype.offset=function(b){var +c=0;if(typeof +b==="number")b=[b];if(!(b +instanceof +Array))I("bigarray.js: invalid offset");if(this.dims.length!=b.length)I("Bigarray.get/set: bad number of dimensions");if(this.layout==0)for(var +a=0;a=this.dims[a])cf();c=c*this.dims[a]+b[a]}else +for(var +a=this.dims.length-1;a>=0;a--){if(b[a]<1||b[a]>this.dims[a])cf();c=c*this.dims[a]+(b[a]-1)}return c};be.prototype.get=function(a){switch(this.kind){case +7:var +d=this.data[a*2+0],b=this.data[a*2+1];return hl(d,b);case +10:case +11:var +e=this.data[a*2+0],c=this.data[a*2+1];return[cb,e,c];default:return this.data[a]}};be.prototype.set=function(a,b){switch(this.kind){case +7:this.data[a*2+0]=ev(b);this.data[a*2+1]=eu(b);break;case +10:case +11:this.data[a*2+0]=b[1];this.data[a*2+1]=b[2];break;default:this.data[a]=b;break}return 0};be.prototype.fill=function(b){switch(this.kind){case +7:var +c=ev(b),e=eu(b);if(c==e)this.data.fill(c);else +for(var +a=0;ad)return 1;if(c!=d){if(!g)return NaN;if(c==c)return 1;if(d==d)return-1}}break;case +7:for(var +a=0;ab.data[a+1])return 1;if(this.data[a]>>>0>>0)return-1;if(this.data[a]>>>0>b.data[a]>>>0)return 1}break;case +2:case +3:case +4:case +5:case +6:case +8:case +9:case +12:for(var +a=0;ab.data[a])return 1}break}return 0};function +bD(c,d,b,a){this.kind=c;this.layout=d;this.dims=b;this.data=a}bD.prototype=new +be();bD.prototype.offset=function(a){if(typeof +a!=="number")if(a +instanceof +Array&&a.length==1)a=a[0];else +I("Ml_Bigarray_c_1_1.offset");if(a<0||a>=this.dims[0])cf();return a};bD.prototype.get=function(a){return this.data[a]};bD.prototype.set=function(a,b){this.data[a]=b;return 0};bD.prototype.fill=function(a){this.data.fill(a);return 0};function +g8(c,d,a,b){var +e=g_(c);if(em(a)*e!=b.length)I("length doesn't match dims");if(d==0&&a.length==1&&e==1)return new +bD(c,d,a,b);return new +be(c,d,a,b)}function +bm(a){ez(H.Failure,a)}function +g9(b,v,r){var +i=b.read32s();if(i<0||i>16)bm("input_value: wrong number of bigarray dimensions");var +p=b.read32s(),j=p&am,o=p>>8&1,h=[];if(r==eh)for(var +a=0;a>>32-15;a=aN(a,0x1b873593);b^=a;b=b<<13|b>>>32-13;return(b+(b<<2)|0)+(0xe6546b64|0)|0}function +sH(a,b){a=T(a,ev(b));a=T(a,eu(b));return a}function +ep(a,b){return sH(a,c9(b))}function +g$(c){var +b=em(c.dims),d=0;switch(c.kind){case +2:case +3:case +12:if(b>bA)b=bA;var +e=0,a=0;for(a=0;a+4<=c.data.length;a+=4){e=c.data[a+0]|c.data[a+1]<<8|c.data[a+2]<<16|c.data[a+3]<<24;d=T(d,e)}e=0;switch(b&3){case +3:e=c.data[a+2]<<16;case +2:e|=c.data[a+1]<<8;case +1:e|=c.data[a+0];d=T(d,e)}break;case +4:case +5:if(b>ce)b=ce;var +e=0,a=0;for(a=0;a+2<=c.data.length;a+=2){e=c.data[a+0]|c.data[a+1]<<16;d=T(d,e)}if((b&1)!=0)d=T(d,c.data[a]);break;case +6:if(b>64)b=64;for(var +a=0;a64)b=64;for(var +a=0;a32)b=32;b*=2;for(var +a=0;a64)b=64;for(var +a=0;a32)b=32;for(var +a=0;a0?b(c,f,e):b(f,c,e);if(e&&a!=a)return d;if(+a!=+a)return+a;if((a|0)!=0)return a|0}return d}function +cl(a){return a +instanceof +aZ}function +c$(a){return cl(a)}function +hh(a){if(typeof +a==="number")return ar;else +if(cl(a))return ef;else +if(c$(a))return 1252;else +if(a +instanceof +Array&&a[0]===a[0]>>>0&&a[0]<=bx){var +b=a[0]|0;return b==cb?0:b}else +if(a +instanceof +String)return gk;else +if(typeof +a=="string")return gk;else +if(a +instanceof +Number)return ar;else +if(a&&a.caml_custom)return d5;else +if(a&&a.compare)return 1256;else +if(typeof +a=="function")return 1247;else +if(typeof +a=="symbol")return 1251;return 1001}function +c_(a,b){if(ab.c?1:0}function +eA(a,b){return hc(a,b)}function +bE(a,b,d){var +e=[];for(;;){if(!(d&&a===b)){var +f=hh(a);if(f==cT){a=a[1];continue}var +g=hh(b);if(g==cT){b=b[1];continue}if(f!==g){if(f==ar){if(g==d5)return hg(a,b,-1,d);return-1}if(g==ar){if(f==d5)return hg(b,a,1,d);return 1}return fb)return 1;if(a!=b){if(!d)return NaN;if(a==a)return 1;if(b==b)return-1}break;case +1001:if(ab)return 1;if(a!=b){if(!d)return NaN;if(a==a)return 1;if(b==b)return-1}break;case +1251:if(a!==b){if(!d)return NaN;return 1}break;case +1252:var +a=az(a),b=az(b);if(a!==b){if(ab)return 1}break;case +12520:var +a=a.toString(),b=b.toString();if(a!==b){if(ab)return 1}break;case +246:case +254:default:if(a.length!=b.length)return a.length1)e.push(a,b,1);break}}if(e.length==0)return 0;var +h=e.pop();b=e.pop();a=e.pop();if(h+10)if(c==0&&(b>=a.l||a.t==2&&b>=a.c.length))if(d==0){a.c=i;a.t=2}else{a.c=bI(b,String.fromCharCode(d));a.t=b==a.l?0:2}else{if(a.t!=4)c7(a);for(b+=c;c31)I("format_int: format too long");var +a={justify:aV,signstyle:X,filler:aS,alternate:false,base:0,signedconv:false,width:0,uppercase:false,sign:1,prec:-1,conv:"f"};for(var +c=0;c=0&&b<=9){a.width=a.width*10+b;c++}c--;break;case".":a.prec=0;c++;while(b=d.charCodeAt(c)-48,b>=0&&b<=9){a.prec=a.prec*10+b;c++}c--;case"d":case"i":a.signedconv=true;case"u":a.base=10;break;case"x":a.base=16;break;case"X":a.base=16;a.uppercase=true;break;case"o":a.base=8;break;case"e":case"f":case"g":a.signedconv=true;a.conv=b;break;case"E":case"F":case"G":a.signedconv=true;a.uppercase=true;a.conv=b.toLowerCase();break}}return a}function +eo(b,f){if(b.uppercase)f=f.toUpperCase();var +e=f.length;if(b.signedconv&&(b.sign<0||b.signstyle!=X))e++;if(b.alternate){if(b.base==8)e+=1;if(b.base==16)e+=2}var +c=i;if(b.justify==aV&&b.filler==aS)for(var +d=e;d20){c-=20;a/=Math.pow(10,c);a+=new +Array(c+1).join(q);if(b>0)a=a+aY+new +Array(b+1).join(q);return a}else +return a.toFixed(b)}}var +a,e=ey(i),d=e.prec<0?6:e.prec;if(c<0||c==0&&1/c==-Infinity){e.sign=-1;c=-c}if(isNaN(c)){a=d7;e.filler=aS}else +if(!isFinite(c)){a=gW;e.filler=aS}else +switch(e.conv){case"e":var +a=c.toExponential(d),b=a.length;if(a.charAt(b-3)==c5)a=a.slice(0,b-1)+q+a.slice(b-1);break;case"f":a=j(c,d);break;case"g":d=d?d:1;a=c.toExponential(d-1);var +h=a.indexOf(c5),g=+a.slice(h+1);if(g<-4||c>=1e21||c.toFixed(0).length>d){var +b=h-1;while(a.charAt(b)==q)b--;if(a.charAt(b)==aY)b--;a=a.slice(0,b+1)+a.slice(h);b=a.length;if(a.charAt(b-3)==c5)a=a.slice(0,b-1)+q+a.slice(b-1);break}else{var +f=d;if(g<0){f-=g+1;a=c.toFixed(f)}else +while(a=c.toFixed(f),a.length>d+1)f--;if(f){var +b=a.length-1;while(a.charAt(b)==q)b--;if(a.charAt(b)==aY)b--;a=a.slice(0,b+1)}}break}return eo(e,a)}function +c8(e,c){if(az(e)==gK)return a(i+c);var +b=ey(e);if(c<0)if(b.signedconv){b.sign=-1;c=-c}else +c>>>=0;var +d=c.toString(b.base);if(b.prec>=0){b.filler=aS;var +f=b.prec-d.length;if(f>0)d=bI(f,q)+d}return eo(b,d)}var +ht=0;function +Q(){return ht++}function +ho(a){return a.toUtf16()}if(n.process&&n.process.cwd)var +ch=n.process.cwd().replace(/\\/g,aU);else +var +ch="/static";if(ch.slice(-1)!==aU)ch+=aU;function +s2(a){a=ho(a);if(a.charCodeAt(0)!=47)a=ch+a;var +d=a.split(aU),b=[];for(var +c=0;c1)b.pop();break;case".":break;case"":if(b.length==0)b.push(i);break;default:b.push(d[c]);break}b.orig=a;return b}function +sx(a){return new +aZ(4,a,a.length)}function +tl(e){for(var +f=i,b=f,a,h,c=0,g=e.length;cd2){b.substr(0,1);f+=b;b=i;f+=e.slice(c,d)}else +b+=e.slice(c,d);if(d==g)break;c=d}if(a>6);b+=String.fromCharCode(as|a&by)}else +if(a<0xd800||a>=ge)b+=String.fromCharCode(gf|a>>12,as|a>>6&by,as|a&by);else +if(a>=0xdbff||c+1==g||(h=e.charCodeAt(c+1))ge)b+="\xef\xbf\xbd";else{c++;a=(a<<10)+h-0x35fdc00;b+=String.fromCharCode(gS|a>>18,as|a>>12&by,as|a>>6&by,as|a&by)}if(b.length>b9){b.substr(0,1);f+=b;b=i}}return f+b}function +sy(a){var +b=9;if(!hw(a))b=8,a=tl(a);return new +aZ(b,a,a.length)}function +aA(a){return sy(a)}function +D(a){ez(H.Sys_error,a)}function +ta(a){a=az(a);D(a+": No such file or directory")}function +an(a){return a.l}function +g6(){}function +S(a){this.data=a}S.prototype=new +g6();S.prototype.truncate=function(a){var +b=this.data;this.data=G(a|0);bf(b,0,this.data,0,a)};S.prototype.length=function(){return an(this.data)};S.prototype.write=function(b,d,g,a){var +c=this.length();if(b+a>=c){var +e=G(b+a),f=this.data;this.data=e;bf(f,0,this.data,0,c)}bg(d,g,this.data,b,a);return 0};S.prototype.read=function(c,a,d,b){var +e=this.length();bf(this.data,c,a,d,b);return 0};S.prototype.read_one=function(a){return bh(this.data,a)};S.prototype.close=function(){};S.prototype.constructor=S;function +au(b,a){this.content={};this.root=b;this.lookupFun=a}au.prototype.nm=function(a){return this.root+a};au.prototype.lookup=function(b){if(!this.content[b]&&this.lookupFun){var +c=this.lookupFun(a(this.root),a(b));if(c!==0)this.content[b]=new +S(a0(c[1]))}};au.prototype.exists=function(a){if(a==i)return 1;var +c=a+aU,d=new +RegExp(d8+c);for(var +b +in +this.content)if(b.match(d))return 1;this.lookup(a);return this.content[a]?1:0};au.prototype.readdir=function(c){var +f=c==i?i:c+aU,g=new +RegExp(d8+f+gZ),d={},b=[];for(var +e +in +this.content){var +a=e.match(g);if(a&&!d[a[1]]){d[a[1]]=true;b.push(a[1])}}return b};au.prototype.is_dir=function(a){var +d=a==i?i:a+aU,e=new +RegExp(d8+d+gZ),f=[];for(var +c +in +this.content){var +b=c.match(e);if(b)return 1}return 0};au.prototype.unlink=function(a){var +b=this.content[a]?true:false;delete +this.content[a];return b};au.prototype.open=function(a,b){if(b.rdonly&&b.wronly)D(this.nm(a)+gn);if(b.text&&b.binary)D(this.nm(a)+gG);this.lookup(a);if(this.content[a]){if(this.is_dir(a))D(this.nm(a)+" : is a directory");if(b.create&&b.excl)D(this.nm(a)+gm);var +c=this.content[a];if(b.truncate)c.truncate();return c}else +if(b.create){this.content[a]=new +S(G(0));return this.content[a]}else +ta(this.nm(a))};au.prototype.register=function(b,a){if(this.content[b])D(this.nm(b)+gm);if(cl(a))this.content[b]=new +S(a);if(c$(a))this.content[b]=new +S(a0(a));else +if(a +instanceof +Array)this.content[b]=new +S(sx(a));else +if(typeof +a==="string")this.content[b]=new +S(he(a));else +if(a.toString){var +c=a0(aA(a.toString()));this.content[b]=new +S(c)}else +D(this.nm(b)+" : registering file with invalid content type")};au.prototype.constructor=au;function +s(a){return an(a)}function +bJ(b,a){return cg(b,a)}function +st(d){var +c=s(d),b=new +Array(c),a=0;for(;a=0)}function +eq(d,b){var +e=b.length,a,c;for(a=0;a+4<=e;a+=4){c=b.charCodeAt(a)|b.charCodeAt(a+1)<<8|b.charCodeAt(a+2)<<16|b.charCodeAt(a+3)<<24;d=T(d,c)}c=0;switch(e&3){case +3:c=b.charCodeAt(a+2)<<16;case +2:c|=b.charCodeAt(a+1)<<8;case +1:c|=b.charCodeAt(a);d=T(d,c)}d^=e;return d}function +sI(a,b){return eq(a,az(b))}function +sF(d,b){var +e=b.length,a,c;for(a=0;a+4<=e;a+=4){c=b[a]|b[a+1]<<8|b[a+2]<<16|b[a+3]<<24;d=T(d,c)}c=0;switch(e&3){case +3:c=b[a+2]<<16;case +2:c|=b[a+1]<<8;case +1:c|=b[a];d=T(d,c)}d^=e;return d}function +sE(a,b){switch(b.t&6){default:bi(b);case +0:a=eq(a,b.c);break;case +2:a=sF(a,b.c)}return a}function +sG(a){a^=a>>>16;a=aN(a,0x85ebca6b|0);a^=a>>>13;a=aN(a,0xc2b2ae35|0);a^=a>>>16;return a}function +sD(j,l,n,m){var +f,g,h,d,c,b,a,e,i;d=l;if(d<0||d>bA)d=bA;c=j;b=n;f=[m];g=0;h=1;while(g0){a=f[g++];if(a&&a.caml_custom){if(bF[a.caml_custom]&&bF[a.caml_custom].hash){var +k=bF[a.caml_custom].hash(a);b=T(b,k);c--}}else +if(a +instanceof +Array&&a[0]===(a[0]|0))switch(a[0]){case +248:b=T(b,a[2]);c--;break;case +250:f[--g]=a[1];break;default:var +o=a.length-1<<10|a[0];b=T(b,o);for(e=1,i=a.length;e=d)break;f[h++]=a[e]}break}else +if(cl(a)){b=sE(b,a);c--}else +if(c$(a)){b=sI(b,a);c--}else +if(typeof +a==="string"){b=eq(b,a);c--}else +if(a===(a|0)){b=T(b,a+a+1);c--}else +if(a===+a){b=ep(b,a);c--}}b=sG(b);return b&0x3FFFFFFF}function +sJ(a,c,l){if(!isFinite(a)){if(isNaN(a))return aA(d7);return aA(a>0?gT:"-infinity")}var +j=a==0&&1/a==-Infinity?1:a>=0?0:1;if(j)a=-a;var +d=0;if(a==0);else +if(a<1)while(a<1&&d>-1022){a*=2;d--}else +while(a>=2){a/=2;d++}var +k=d<0?i:aV,e=i;if(j)e=X;else +switch(l){case +43:e=aV;break;case +32:e=aS;break;default:break}if(c>=0&&c<13){var +g=Math.pow(2,c*4);a=Math.round(a*g)/g}var +b=a.toString(16);if(c>=0){var +h=b.indexOf(aY);if(h<0)b+=aY+bI(c,q);else{var +f=h+1+c;if(b.length>24&aX,a>>31&aJ)}function +sU(a){return a.toInt()}function +sO(a){return+a.isNeg()}function +sR(a){return a.neg()}function +sM(g,c){var +a=ey(g);if(a.signedconv&&sO(c)){a.sign=-1;c=sR(c)}var +b=i,h=sS(a.base),f="0123456789abcdef";do{var +e=c.udivmod(h);c=e.quotient;b=f.charAt(sU(e.modulus))+b}while(!sP(c));if(a.prec>=0){a.filler=aS;var +d=a.prec-b.length;if(d>0)b=bI(d,q)+b}return eo(a,b)}function +sT(a,b){return a.or(b)}function +hn(a){return a.toFloat()}function +sW(){return typeof +module!=="undefined"&&module&&module.exports?module.exports:n}function +sX(c){var +d=c.length,b=new +Array(d+1);b[0]=0;for(var +a=0;a0){var +c=new +Array(b);for(var +a=0;aaI){a-=aI;b*=Math.pow(2,aI);if(a>aI){a-=aI;b*=Math.pow(2,aI)}}if(a<-aI){a+=aI;b*=Math.pow(2,-aI)}b*=Math.pow(2,a);return b}function +s1(a,b){return+(bE(a,b,false)<=0)}function +ew(a,b){return+(bE(a,b,false)<0)}function +a2(a,d){if(a<0)cf();var +a=a+1|0,b=new +Array(a);b[0]=0;for(var +c=1;c>>32-b,c)}function +g(c,b,d,e,h,f,g){return a(b&d|~b&e,c,b,h,f,g)}function +h(d,b,e,c,h,f,g){return a(b&c|e&~c,d,b,h,f,g)}function +i(c,b,d,e,h,f,g){return a(b^d^e,c,b,h,f,g)}function +j(c,b,d,e,h,f,g){return a(d^(b|~e),c,b,h,f,g)}function +k(f,n){var +e=n;f[e>>2]|=as<<8*(e&3);for(e=(e&~0x3)+8;(e&0x3F)<60;e+=4)f[(e>>2)-1]=0;f[(e>>2)-1]=n<<3;f[e>>2]=n>>29&0x1FFFFFFF;var +k=[0x67452301,0xEFCDAB89,0x98BADCFE,0x10325476];for(e=0;e>8*m&0xFF;return o}return function(h,g,f){var +e=[];switch(h.t&6){default:bi(h);case +0:var +d=h.c;for(var +a=0;a>2]=d.charCodeAt(b)|d.charCodeAt(b+1)<<8|d.charCodeAt(b+2)<<16|d.charCodeAt(b+3)<<24}for(;a>2]|=d.charCodeAt(a+g)<<8*(a&3);break;case +4:var +c=h.c;for(var +a=0;a>2]=c[b]|c[b+1]<<8|c[b+2]<<16|c[b+3]<<24}for(;a>2]|=c[a+g]<<8*(a&3)}return tg(k(e,f))}}();function +s4(c,b,a){return s3(a0(c),b,a)}var +aM=new +Array();function +ex(c){var +a=aM[c];if(!a.opened)D("Cannot flush a closed channel");if(!a.buffer||a.buffer==i)return 0;if(a.fd&&H.fds[a.fd]&&H.fds[a.fd].output){var +b=H.fds[a.fd].output;switch(b.length){case +2:b(c,a.buffer);break;default:b(a.buffer)}}a.buffer=i;return 0}function +hv(e,f){var +b=aM[e],d=a(f),c=s(d);b.file.write(b.offset,d,0,c);b.offset+=c;return 0}function +tp(a){var +a=eC(a),b=n;if(b.process&&b.process.stdout&&b.process.stdout.write)b.process.stderr.write(a);else{if(a.charCodeAt(a.length-1)==10)a=a.substr(0,a.length-1);var +c=b.console;c&&c.error&&c.error(a)}}function +tq(a){var +a=eC(a),b=n;if(b.process&&b.process.stdout&&b.process.stdout.write)b.process.stdout.write(a);else{if(a.charCodeAt(a.length-1)==10)a=a.substr(0,a.length-1);var +c=b.console;c&&c.log&&c.log(a)}}function +de(c,e,d,a){if(H.fds===undefined)H.fds=new +Array();a=a?a:{};var +b={};b.file=d;b.offset=a.append?d.length():0;b.flags=a;b.output=e;H.fds[c]=b;if(!H.fd_last_idx||c>H.fd_last_idx)H.fd_last_idx=c;return c}function +tG(c,b,g){var +a={};while(b){switch(b[1]){case +0:a.rdonly=1;break;case +1:a.wronly=1;break;case +2:a.append=1;break;case +3:a.create=1;break;case +4:a.truncate=1;break;case +5:a.excl=1;break;case +6:a.binary=1;break;case +7:a.text=1;break;case +8:a.nonblock=1;break}b=b[2]}if(a.rdonly&&a.wronly)D(az(c)+gn);if(a.text&&a.binary)D(az(c)+gG);var +d=hB(c),e=d.device.open(d.rest,a),f=H.fd_last_idx?H.fd_last_idx:0;return de(f+1,hv,e,a)}de(0,hv,new +S(G(0)));de(1,tq,new +S(G(0)));de(2,tp,new +S(G(0)));function +s5(c){var +b=H.fds[c];if(b.flags.wronly)D(g2+c+" is writeonly");var +a={file:b.file,offset:b.offset,fd:c,opened:true,out:false,refill:null};aM[a.fd]=a;return a.fd}function +hp(c){var +b=H.fds[c];if(b.flags.rdonly)D(g2+c+" is readonly");var +a={file:b.file,offset:b.offset,fd:c,opened:true,out:true,buffer:i};aM[a.fd]=a;return a.fd}function +s6(){var +b=0;for(var +a=0;a>>0)return a[0];else +if(cl(a))return ef;else +if(c$(a))return ef;else +if(a +instanceof +Function||typeof +a=="function")return 247;else +if(a&&a.caml_custom)return bx;else +return ar}function +aw(b,c,a){if(a&&n.toplevelReloc)b=n.toplevelReloc(a);H[b+1]=c;if(a)H[a]=c}var +hq={};function +td(a,b){hq[az(a)]=b;return 0}function +te(a){a[2]=ht++;return a}function +eB(a,b){return hd(a,b)}function +tf(){I(ei)}function +m(b,a){if(a>>>0>=s(b))tf();return bJ(b,a)}function +J(a,b){return 1-eB(a,b)}function +th(){return[0,a("js_of_ocaml")]}function +ti(){return 0x7FFFFFFF/4|0}function +tj(){return[0,a("Unix"),32,0]}function +tb(){db(H.Not_found)}function +dd(c){var +a=n,b=ho(c);if(a.process&&a.process.env&&a.process.env[b]!=undefined)return aA(a.process.env[b]);if(n.jsoo_static_env&&n.jsoo_static_env[b])return aA(n.jsoo_static_env[b]);tb()}function +tk(){var +a=new +Date().getTime(),b=a^gV*Math.random();return[0,b]}function +cm(a){var +b=1;while(a&&a.joo_tramp){a=a.joo_tramp.apply(null,a.joo_args);b++}return a}function +N(b,a){return{joo_tramp:b,joo_args:a}}function +hu(a){return a}function +da(a){return hq[a]}function +e(a){if(a +instanceof +Array)return a;if(n.RangeError&&a +instanceof +n.RangeError&&a.message&&a.message.match(/maximum call stack/i))return hu(H.Stack_overflow);if(n.InternalError&&a +instanceof +n.InternalError&&a.message&&a.message.match(/too much recursion/i))return hu(H.Stack_overflow);if(a +instanceof +n.Error&&da(d4))return[0,da(d4),a];return[0,H.Failure,aA(String(a))]}var +h=function(B){"use strict";var +f=bl,ac=7,v=9007199254740992,J=s(v),O="0123456789abcdefghijklmnopqrstuvwxyz",g=n.BigInt,H=typeof +g==="function";function +d(a,b,c,f){if(typeof +a==="undefined")return d[0];if(typeof +b!=="undefined")return+b===10&&!c?e(a):ag(a,b,c,f);return e(a)}function +a(b,a){this.value=b;this.sign=a;this.isSmall=false;this.caml_custom=cQ}a.prototype=Object.create(d.prototype);function +b(a){this.value=a;this.sign=a<0;this.isSmall=true;this.caml_custom=cQ}b.prototype=Object.create(d.prototype);function +c(a){this.value=a;this.caml_custom=cQ}c.prototype=Object.create(d.prototype);function +r(a){return-v0)return Math.floor(a);return Math.ceil(a)}function +P(g,h){var +i=g.length,j=h.length,e=new +Array(i),b=0,d=f,c,a;for(a=0;a=d?1:0;e[a]=c-b*d}while(a0)e.push(b);return e}function +w(a,b){if(a.length>=b.length)return P(a,b);return P(b,a)}function +C(g,a){var +h=g.length,d=new +Array(h),c=f,e,b;for(b=0;b0){d[b++]=a%c;a=Math.floor(a/c)}return d}a.prototype.add=function(f){var +b=e(f);if(this.sign!==b.sign)return this.subtract(b.negate());var +c=this.value,d=b.value;if(b.isSmall)return new +a(C(c,Math.abs(d)),this.sign);return new +a(w(c,d),this.sign)};a.prototype.plus=a.prototype.add;b.prototype.add=function(g){var +f=e(g),c=this.value;if(c<0!==f.sign)return this.subtract(f.negate());var +d=f.value;if(f.isSmall){if(r(c+d))return new +b(c+d);d=s(Math.abs(d))}return new +a(C(d,Math.abs(c)),c<0)};b.prototype.plus=b.prototype.add;c.prototype.add=function(a){return new +c(this.value+e(a).value)};c.prototype.plus=c.prototype.add;function +z(d,h){var +g=d.length,i=h.length,c=new +Array(g),e=0,j=f,a,b;for(a=0;a=0)c=z(e,f);else{c=z(f,e);d=!d}c=o(c);if(typeof +c==="number"){if(d)c=-c;return new +b(c)}return new +a(c,d)}function +G(h,l,k){var +j=h.length,c=new +Array(j),i=-l,g=f,e,d;for(e=0;e=0)};b.prototype.minus=b.prototype.subtract;c.prototype.subtract=function(a){return new +c(this.value-e(a).value)};c.prototype.minus=c.prototype.subtract;a.prototype.negate=function(){return new +a(this.value,!this.sign)};b.prototype.negate=function(){var +c=this.sign,a=new +b(-this.value);a.sign=!c;return a};c.prototype.negate=function(){return new +c(-this.value)};a.prototype.abs=function(){return new +a(this.value,false)};b.prototype.abs=function(){return new +b(Math.abs(this.value))};c.prototype.abs=function(){return new +c(this.value>=0?this.value:-this.value)};function +N(g,j){var +i=g.length,l=j.length,n=i+l,c=D(n),m=f,e,d,a,h,k;for(a=0;a0){e[b++]=a%c;a=Math.floor(a/c)}return e}function +Z(c,b){var +a=[];while(b-->0)a.push(0);return a.concat(c)}function +E(b,c){var +a=Math.max(b.length,c.length);if(a<=30)return N(b,c);a=Math.ceil(a/2);var +f=b.slice(a),d=b.slice(0,a),i=c.slice(a),h=c.slice(0,a),e=E(d,h),g=E(f,i),k=E(w(d,f),w(h,i)),j=w(w(e,Z(z(z(k,e),g),a)),Z(g,2*a));t(j);return j}function +am(a,b){return-(gN*a)-gN*b+0.000015*a*b>0}a.prototype.multiply=function(j){var +h=e(j),c=this.value,b=h.value,i=this.sign!==h.sign,g;if(h.isSmall){if(b===0)return d[0];if(b===1)return this;if(b===-1)return this.negate();g=Math.abs(b);if(g=0;d--){j=g-1;if(b[d+h]!==l)j=Math.floor((b[d+h]*g+b[d+h-1])/l);c=0;e=0;m=i.length;for(a=0;ah)d=(d+1)*i;c=Math.ceil(d/m);do{j=x(b,c);if(p(j,a)<=0)break;c--}while(c);e.push(c);a=z(a,j)}e.reverse();return[o(e),o(a)]}function +Q(i,e){var +g=i.length,h=D(g),j=f,a,d,b,c;b=0;for(a=g-1;a>=0;--a){c=b*j+i[a];d=u(c/e);b=c-d*e;h[a]=d|0}return[h,b|0]}function +k(h,w){var +m,j=e(w);if(H)return[new +c(h.value/j.value),new +c(h.value%j.value)];var +l=h.value,i=j.value,g;if(i===0)throw new +Error("Cannot divide by zero");if(h.isSmall){if(j.isSmall)return[new +b(u(l/i)),new +b(l%i)];return[d[0],h]}if(j.isSmall){if(i===1)return[h,d[0]];if(i==-1)return[h.negate(),d[0]];var +q=Math.abs(i);if(qc.length?1:-1;for(var +a=b.length-1;a>=0;a--)if(b[a]!==c[a])return b[a]>c[a]?1:-1;return 0}a.prototype.compareAbs=function(d){var +a=e(d),b=this.value,c=a.value;if(a.isSmall)return 1;return p(b,c)};b.prototype.compareAbs=function(d){var +c=e(d),b=Math.abs(this.value),a=c.value;if(c.isSmall){a=Math.abs(a);return b===a?0:b>a?1:-1}return-1};c.prototype.compareAbs=function(c){var +a=this.value,b=e(c).value;a=a>=0?a:-a;b=b>=0?b:-b;return a===b?0:a>b?1:-1};a.prototype.compare=function(b){if(b===Infinity)return-1;if(b===-Infinity)return 1;var +a=e(b),c=this.value,d=a.value;if(this.sign!==a.sign)return a.sign?1:-1;if(a.isSmall)return this.sign?-1:1;return p(c,d)*(this.sign?-1:1)};a.prototype.compareTo=a.prototype.compare;b.prototype.compare=function(c){if(c===Infinity)return-1;if(c===-Infinity)return 1;var +b=e(c),a=this.value,d=b.value;if(b.isSmall)return a==d?0:a>d?1:-1;if(a<0!==b.sign)return a<0?-1:1;return a<0?1:-1};b.prototype.compareTo=b.prototype.compare;c.prototype.compare=function(a){if(a===Infinity)return-1;if(a===-Infinity)return 1;var +b=this.value,c=e(a).value;return b===c?0:b>c?1:-1};c.prototype.compareTo=c.prototype.compare;a.prototype.equals=function(a){return this.compare(a)===0};c.prototype.eq=c.prototype.equals=b.prototype.eq=b.prototype.equals=a.prototype.eq=a.prototype.equals;a.prototype.notEquals=function(a){return this.compare(a)!==0};c.prototype.neq=c.prototype.notEquals=b.prototype.neq=b.prototype.notEquals=a.prototype.neq=a.prototype.notEquals;a.prototype.greater=function(a){return this.compare(a)>0};c.prototype.gt=c.prototype.greater=b.prototype.gt=b.prototype.greater=a.prototype.gt=a.prototype.greater;a.prototype.lesser=function(a){return this.compare(a)<0};c.prototype.lt=c.prototype.lesser=b.prototype.lt=b.prototype.lesser=a.prototype.lt=a.prototype.lesser;a.prototype.greaterOrEquals=function(a){return this.compare(a)>=0};c.prototype.geq=c.prototype.greaterOrEquals=b.prototype.geq=b.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals;a.prototype.lesserOrEquals=function(a){return this.compare(a)<=0};c.prototype.leq=c.prototype.lesserOrEquals=b.prototype.leq=b.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals;a.prototype.isEven=function(){return(this.value[0]&1)===0};b.prototype.isEven=function(){return(this.value&1)===0};c.prototype.isEven=function(){return(this.value&g(1))===g(0)};a.prototype.isOdd=function(){return(this.value[0]&1)===1};b.prototype.isOdd=function(){return(this.value&1)===1};c.prototype.isOdd=function(){return(this.value&g(1))===g(1)};a.prototype.isPositive=function(){return!this.sign};b.prototype.isPositive=function(){return this.value>0};c.prototype.isPositive=b.prototype.isPositive;a.prototype.isNegative=function(){return this.sign};b.prototype.isNegative=function(){return this.value<0};c.prototype.isNegative=b.prototype.isNegative;a.prototype.isUnit=function(){return false};b.prototype.isUnit=function(){return Math.abs(this.value)===1};c.prototype.isUnit=function(){return this.abs().value===g(1)};a.prototype.isZero=function(){return false};b.prototype.isZero=function(){return this.value===0};c.prototype.isZero=function(){return this.value===g(0)};a.prototype.isDivisibleBy=function(b){var +a=e(b);if(a.isZero())return false;if(a.isUnit())return true;if(a.compareAbs(2)===0)return this.isEven();return this.mod(a).isZero()};c.prototype.isDivisibleBy=b.prototype.isDivisibleBy=a.prototype.isDivisibleBy;function +T(b){var +a=b.abs();if(a.isUnit())return false;if(a.equals(2)||a.equals(3)||a.equals(5))return true;if(a.isEven()||a.isDivisibleBy(3)||a.isDivisibleBy(5))return false;if(a.lesser(49))return true}function +L(d,e){var +g=d.prev(),c=g,i=0,f,j,b,a;while(c.isEven())c=c.divide(2),i++;next:for(b=0;b-v)return new +b(c-1);return new +a(J,true)};c.prototype.prev=function(){return new +c(this.value-g(1))};var +j=[1];while(2*j[j.length-1]<=f)j.push(2*j[j.length-1]);var +y=j.length,l=j[y-1];function +_(a){return Math.abs(a)<=f}a.prototype.shiftLeft=function(c){var +a=e(c).toJSNumber();if(!_(a))throw new +Error(String(a)+gx);if(a<0)return this.shiftRight(-a);var +b=this;if(b.isZero())return b;while(a>=y){b=b.multiply(l);a-=y-1}return b.multiply(j[a])};c.prototype.shiftLeft=b.prototype.shiftLeft=a.prototype.shiftLeft;a.prototype.shiftRight=function(d){var +a,b=e(d).toJSNumber();if(!_(b))throw new +Error(String(b)+gx);if(b<0)return this.shiftLeft(-b);var +c=this;while(b>=y){if(c.isZero()||c.isNegative()&&c.isUnit())return c;a=k(c,l);c=a[1].isNegative()?a[0].prev():a[0];b-=y-1}a=k(c,j[b]);return a[1].isNegative()?a[0].prev():a[0]};c.prototype.shiftRight=b.prototype.shiftRight=a.prototype.shiftRight;function +K(i,a,r){a=e(a);var +n=i.isNegative(),q=a.isNegative(),m=n?i.not():i,p=q?a.not():a,b=0,c=0,j=null,o=null,f=[];while(!m.isZero()||!p.isZero()){j=k(m,l);b=j[1].toJSNumber();if(n)b=l-1-b;o=k(p,l);c=o[1].toJSNumber();if(q)c=l-1-c;m=j[0];p=o[0];f.push(r(b,c))}var +g=r(n?1:0,q?1:0)!==0?h(-1):h(0);for(var +d=f.length-1;d>=0;d-=1)g=g.multiply(l).add(h(f[d]));return g}a.prototype.not=function(){return this.negate().prev()};c.prototype.not=b.prototype.not=a.prototype.not;a.prototype.and=function(a){return K(this,a,function(a,b){return a&b})};c.prototype.and=b.prototype.and=a.prototype.and;a.prototype.or=function(a){return K(this,a,function(a,b){return a|b})};c.prototype.or=b.prototype.or=a.prototype.or;a.prototype.xor=function(a){return K(this,a,function(a,b){return a^b})};c.prototype.xor=b.prototype.xor=a.prototype.xor;var +I=1<<30,ab=(f&-f)*(f&-f)|I;function +F(c){var +a=c.value,b=typeof +a==="number"?a|I:typeof +a==="bigint"?a|g(I):a[0]+a[1]*f|ab;return b&-b}function +S(b,a){if(a.compareTo(b)<=0){var +f=S(b,a.square(a)),d=f.p,c=f.e,e=d.multiply(a);return e.compareTo(b)<=0?{p:e,e:c*2+1}:{p:d,e:c*2}}return{p:h(1),e:0}}a.prototype.bitLength=function(){var +a=this;if(a.compareTo(h(0))<0)a=a.negate().subtract(h(1));if(a.compareTo(h(0))===0)return h(0);return h(S(a,h(2)).e).add(h(1))};c.prototype.bitLength=b.prototype.bitLength=a.prototype.bitLength;function +U(a,b){a=e(a);b=e(b);return a.greater(b)?a:b}function +M(a,b){a=e(a);b=e(b);return a.lesser(b)?a:b}function +R(a,b){a=e(a).abs();b=e(b).abs();if(a.equals(b))return a;if(a.isZero())return b;if(b.isZero())return a;var +c=d[1],f,g;while(a.isEven()&&b.isEven()){f=M(F(a),F(b));a=a.divide(f);b=b.divide(f);c=c.multiply(f)}while(a.isEven())a=a.divide(F(a));do{while(b.isEven())b=b.divide(F(b));if(a.greater(b)){g=b;b=a;a=g}b=b.subtract(a)}while(!b.isZero());return c.isUnit()?a:a.multiply(c)}function +af(a,b){a=e(a).abs();b=e(b).abs();return a.divide(R(a,b)).multiply(b)}function +aj(a,b){a=e(a);b=e(b);var +g=M(a,b),n=U(a,b),h=n.subtract(g).add(1);if(h.isSmall)return g.add(Math.floor(Math.random()*h));var +j=A(h,f).value,l=[],k=true;for(var +c=0;c=i){if(c===ai&&i===1)continue;throw new +Error(c+" is not a valid digit in base "+g+aY)}}g=e(g);var +h=[],j=b[0]===X;for(a=j?1:0;a=0;a--){b=b.add(e[a].times(c));c=c.times(f)}return g?b.negate():b}function +ak(b,a){a=a||O;if(b=0){e=c.divmod(b);c=e.quotient;var +d=e.remainder;if(d.isNegative()){d=b.minus(d).abs();c=c.next()}g.push(d.toJSNumber())}g.push(c.toJSNumber());return{value:g.reverse(),isNegative:f}}function +aa(d,c,b){var +a=A(d,c);return(a.isNegative?X:i)+a.value.map(function(a){return ak(a,b)}).join(i)}a.prototype.toArray=function(a){return A(this,a)};b.prototype.toArray=function(a){return A(this,a)};c.prototype.toArray=function(a){return A(this,a)};a.prototype.toString=function(a,f){if(a===B)a=10;if(a!==10)return aa(this,a,f);var +d=this.value,c=d.length,e=String(d[--c]),h="0000000",b;while(--c>=0){b=String(d[c]);e+=h.slice(b.length)+b}var +g=this.sign?X:i;return g+e};b.prototype.toString=function(a,b){if(a===B)a=10;if(a!=10)return aa(this,a,b);return String(this.value)};c.prototype.toString=b.prototype.toString;c.prototype.toJSON=a.prototype.toJSON=b.prototype.toJSON=function(){return this.toString()};a.prototype.valueOf=function(){return parseInt(this.toString(),10)};a.prototype.toJSNumber=a.prototype.valueOf;b.prototype.valueOf=function(){return this.value};b.prototype.toJSNumber=b.prototype.valueOf;c.prototype.valueOf=c.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function +Y(d){if(r(+d)){var +l=+d;if(l===u(l))return H?new +c(g(l)):new +b(l);throw new +Error(cZ+d)}var +o=d[0]===X;if(o)d=d.slice(1);var +h=d.split(/e/i);if(h.length>2)throw new +Error(cZ+h.join(c5));if(h.length===2){var +e=h[1];if(e[0]===aV)e=e.slice(1);e=+e;if(e!==u(e)||!r(e))throw new +Error(cZ+e+" is not a valid exponent.");var +f=h[0],i=f.indexOf(aY);if(i>=0){e-=f.length-i-1;f=f.slice(0,i)+f.slice(i+1)}if(e<0)throw new +Error("Cannot include negative exponent part for integers");f+=new +Array(e+1).join(q);d=f}var +p=/^([0-9][0-9]*)$/.test(d);if(!p)throw new +Error(cZ+d);if(H)return new +c(g(o?X+d:d));var +n=[],j=d.length,m=ac,k=j-m;while(j>0){n.push(+d.slice(k,j));k-=m;if(k<0)k=0;j-=m}t(n);return new +a(n,o)}function +ah(a){if(H)return new +c(g(a));if(r(a)){if(a!==u(a))throw new +Error(a+" is not an integer.");return new +b(a)}return Y(a.toString())}function +e(a){if(typeof +a==="number")return ah(a);if(typeof +a==="string")return Y(a);if(typeof +a==="bigint")return new +c(a);return a}for(var +m=0;m0)d[-m]=e(-m)}d.one=d[1];d.zero=d[0];d.minusOne=d[-1];d.max=U;d.min=M;d.gcd=R;d.lcm=af;d.isInstance=function(d){return d +instanceof +a||d +instanceof +b||d +instanceof +c};d.randBetween=aj;d.fromArray=function(b,a,c){return W(b.map(e),e(a||10),c)};return d}();function +ax(a){var +b=a.toJSNumber()|0;if(a.equals(h(b)))return b;return a}function +K(a,b){return ax(h(a).add(h(b)))}function +bK(a,b){return h(a).compare(h(b))}function +hx(b,a){a=h(a);if(a.equals(h(0)))bG();return ax(h(b).divide(h(a)))}function +tB(b,a){a=h(a);if(a.equals(h(0)))bG();return ax(h(b).mod(a))}function +tu(a,b){return[0,hx(a,b),tB(a,b)]}function +hy(a,b){return hx(a,b)}function +tv(a,b){return h(a).equals(h(b))}function +tx(a,b){return ax(h.gcd(h(a),h(b)).abs())}function +tm(c,e,g){e=h(e);var +a=e.toArray(Math.pow(2,32));c.write(8,a.isNegative?1:0);var +f=a.value.length,d=f*4;c.write(32,d);for(var +b=f-1;b>=0;b--){c.write(8,a.value[b]>>>0&am);c.write(8,a.value[b]>>>8&am);c.write(8,a.value[b]>>>16&am);c.write(8,a.value[b]>>>24&am)}g[0]=4*(1+((d+3)/4|0));g[1]=8*(1+((d+7)/8|0))}function +tn(b,g){var +e;switch(b.read8u()){case +1:e=true;break;case +0:e=false;break;default:bm("input_value: z (malformed input)")}var +f=b.read32u(),c=h(0);for(var +d=0;d>>0);c=a.shiftLeft(d*32).add(c)}if(e)c=c.negate();g[0]=f+4;return ax(c)}function +ty(d){var +b=h(d).toArray(Math.pow(2,32)),a=0;for(var +c=0;c=48&&a<=57)return a-48;if(a>=97&&a<=gI)return a-97+10;if(a>=65&&a<=70)return a-65+10}var +e=0;if(a[e]==X)e++;for(;e=c)I("Z.of_substring_base: invalid digit")}return ax(h(a,c))}function +bp(d,a,b,c){a=az(a);if(b!=0||c!=a.length){if(a.length-b=0?1:0}function +hA(a){a=h(a);if(!tw(a))db(da(ea));var +b=h(gV),d=a.and(b).toJSNumber(),c=a.shiftRight(32).and(b).toJSNumber(),e=hl(d,c);return e}function +df(){return new +Date().getTime()/ar}function +bN(e){var +a=new +Date(e*ar),b=a.getTime(),d=new +Date(Date.UTC(a.getUTCFullYear(),0,1)).getTime(),c=Math.floor((b-d)/gi);return[0,a.getUTCSeconds(),a.getUTCMinutes(),a.getUTCHours(),a.getUTCDate(),a.getUTCMonth(),a.getUTCFullYear()-bd,a.getUTCDay(),c,false|0]}function +dg(){return 0}function +tF(h){var +a=new +Date(h*ar),b=a.getTime(),e=new +Date(a.getFullYear(),0,1).getTime(),c=Math.floor((b-e)/gi),d=new +Date(a.getFullYear(),0,1),f=new +Date(a.getFullYear(),6,1),g=Math.max(d.getTimezoneOffset(),f.getTimezoneOffset());return[0,a.getSeconds(),a.getMinutes(),a.getHours(),a.getDate(),a.getMonth(),a.getFullYear()-bd,a.getDay(),c,a.getTimezoneOffset()>>0))e=1}else +if(65<=d)e=1}else{var +f=0;if(32!==d)if(43<=d)switch(d+gY|0){case +5:if(a<(c+2|0)&&1>>0){if(33<(n-61|0)>>>0)p=1}else +if(2===n)p=1;if(!p){var +j=j+1|0;continue}var +e=a0(k),a=[0,0],r=an(e)-1|0,x=0;if(!(r<0)){var +i=x;for(;;){var +f=cg(e,i),g=0;if(32<=f){var +l=f-34|0,q=0;if(58>>0){if(93<=l)q=1}else +if(56<(l-1|0)>>>0){g=1;q=1}if(!q){var +m=1;g=2}}else +if(11<=f){if(13===f)g=1}else +if(8<=f)g=1;switch(g){case +0:var +m=4;break;case +1:var +m=2;break}a[1]=a[1]+m|0;var +A=i+1|0;if(r!==i){var +i=A;continue}break}}if(a[1]===an(e))var +u=eL(e);else{var +b=G(a[1]);a[1]=0;var +t=an(e)-1|0,y=0;if(!(t<0)){var +h=y;for(;;){var +c=cg(e,h),d=0;if(35<=c)if(92===c)d=2;else +if(d9<=c)d=1;else +d=3;else +if(32<=c)if(34<=c)d=2;else +d=3;else +if(14<=c)d=1;else +switch(c){case +8:F(b,a[1],92);a[1]++;F(b,a[1],98);break;case +9:F(b,a[1],92);a[1]++;F(b,a[1],116);break;case +10:F(b,a[1],92);a[1]++;F(b,a[1],110);break;case +13:F(b,a[1],92);a[1]++;F(b,a[1],114);break;default:d=1}switch(d){case +1:F(b,a[1],92);a[1]++;F(b,a[1],48+(c/at|0)|0);a[1]++;F(b,a[1],48+((c/10|0)%10|0)|0);a[1]++;F(b,a[1],48+(c%10|0)|0);break;case +2:F(b,a[1],92);a[1]++;F(b,a[1],c);break;case +3:F(b,a[1],c);break}a[1]++;var +z=h+1|0;if(t!==h){var +h=z;continue}break}}var +u=b}var +o=Z(u)}var +v=s(o),w=aB(v+2|0,34);bg(o,0,w,1,v);return Z(w)}}function +cw(m,a){if(13<=m){var +g=[0,0],h=s(a)-1|0,n=0;if(!(h<0)){var +c=n;for(;;){if(!(9<(bJ(a,c)+cS|0)>>>0))g[1]++;var +q=c+1|0;if(h!==c){var +c=q;continue}break}}var +i=g[1],j=G(s(a)+((i-1|0)/3|0)|0),k=[0,0],d=function(a){av(j,k[1],a);k[1]++;return 0},e=[0,((i-1|0)%3|0)+1|0],l=s(a)-1|0,o=0;if(!(l<0)){var +b=o;for(;;){var +f=bJ(a,b);if(9<(f+cS|0)>>>0)d(f);else{if(0===e[1]){d(95);e[1]=3}e[1]+=-1;d(f)}var +p=b+1|0;if(l!==b){var +b=p;continue}break}}return Z(j)}return a}function +jP(b,c){switch(b){case +1:var +a=i2;break;case +2:var +a=i3;break;case +4:var +a=i5;break;case +5:var +a=i6;break;case +6:var +a=i7;break;case +7:var +a=i8;break;case +8:var +a=i9;break;case +9:var +a=i_;break;case +10:var +a=i$;break;case +11:var +a=ja;break;case +0:case +13:var +a=i1;break;case +3:case +14:var +a=i4;break;default:var +a=jb}return cw(b,c8(a,c))}function +jQ(b,c){switch(b){case +1:var +a=jq;break;case +2:var +a=jr;break;case +4:var +a=jt;break;case +5:var +a=ju;break;case +6:var +a=jv;break;case +7:var +a=jw;break;case +8:var +a=jx;break;case +9:var +a=jy;break;case +10:var +a=jz;break;case +11:var +a=jA;break;case +0:case +13:var +a=jp;break;case +3:case +14:var +a=js;break;default:var +a=jB}return cw(b,c8(a,c))}function +jR(b,c){switch(b){case +1:var +a=jD;break;case +2:var +a=jE;break;case +4:var +a=jG;break;case +5:var +a=jH;break;case +6:var +a=jI;break;case +7:var +a=jJ;break;case +8:var +a=jK;break;case +9:var +a=jL;break;case +10:var +a=jM;break;case +11:var +a=jN;break;case +0:case +13:var +a=jC;break;case +3:case +14:var +a=jF;break;default:var +a=jO}return cw(b,c8(a,c))}function +jS(b,c){switch(b){case +1:var +a=jd;break;case +2:var +a=je;break;case +4:var +a=jg;break;case +5:var +a=jh;break;case +6:var +a=ji;break;case +7:var +a=jj;break;case +8:var +a=jk;break;case +9:var +a=jl;break;case +10:var +a=jm;break;case +11:var +a=jn;break;case +0:case +13:var +a=jc;break;case +3:case +14:var +a=jf;break;default:var +a=jo}return cw(b,sM(a,c))}function +aP(d,v,h){if(6<=d[2]){switch(d[1]){case +0:var +n=45;break;case +1:var +n=43;break;default:var +n=32}var +w=sJ(h,v,n);if(7<=d[2]){var +l=a0(w),k=an(l);if(0===k)var +u=l;else{var +q=G(k),r=k-1|0,A=0;if(!(r<0)){var +e=A;for(;;){var +g=cg(l,e),z=0;if(97<=g&&!(ek>>0){if(55===o)p=1}else +if(21<(o-1|0)>>>0)p=1;if(!p){var +j=j+1|0;continue}var +y=1}return y?f:a4(f,jW)}}return f}function +b7(e,H,D,C){var +b=H,a=D,d=C;for(;;)if(typeof +d==="number")return c(b,a);else +switch(d[0]){case +0:var +I=d[1];return function(c){return u(b,[5,a,c],I)};case +1:var +J=d[1];return function(c){var +e=0;if(40<=c)if(92===c)var +d=hN;else +if(d9<=c)e=1;else +e=2;else +if(32<=c)if(39<=c)var +d=hO;else +e=2;else +if(14<=c)e=1;else +switch(c){case +8:var +d=hP;break;case +9:var +d=hQ;break;case +10:var +d=hR;break;case +13:var +d=hS;break;default:e=1}switch(e){case +1:var +f=G(4);F(f,0,92);F(f,1,48+(c/at|0)|0);F(f,2,48+((c/10|0)%10|0)|0);F(f,3,48+(c%10|0)|0);var +d=Z(f);break;case +2:var +g=G(1);F(g,0,c);var +d=Z(g);break}var +h=s(d),i=aB(h+2|0,39);bg(d,0,i,1,h);return u(b,[4,a,Z(i)],J)};case +2:var +K=d[2],L=d[1];return dq(b,a,K,L,function(a){return a});case +3:return dq(b,a,d[2],d[1],i0);case +4:return cx(b,a,d[4],d[2],d[3],jP,d[1]);case +5:return cx(b,a,d[4],d[2],d[3],jQ,d[1]);case +6:return cx(b,a,d[4],d[2],d[3],jR,d[1]);case +7:return cx(b,a,d[4],d[2],d[3],jS,d[1]);case +8:var +i=d[4],j=d[3],k=d[2],h=d[1];if(typeof +k==="number"){if(typeof +j==="number")return 0===j?function(c){return u(b,[4,a,aP(h,dn(h),c)],i)}:function(d,c){return u(b,[4,a,aP(h,d,c)],i)};var +af=j[1];return function(c){return u(b,[4,a,aP(h,af,c)],i)}}else{if(0===k[0]){var +n=k[2],o=k[1];if(typeof +j==="number")return 0===j?function(c){return u(b,[4,a,ae(o,n,aP(h,dn(h),c))],i)}:function(d,c){return u(b,[4,a,ae(o,n,aP(h,d,c))],i)};var +ag=j[1];return function(c){return u(b,[4,a,ae(o,n,aP(h,ag,c))],i)}}var +p=k[1];if(typeof +j==="number")return 0===j?function(d,c){return u(b,[4,a,ae(p,d,aP(h,dn(h),c))],i)}:function(e,d,c){return u(b,[4,a,ae(p,e,aP(h,d,c))],i)};var +ah=j[1];return function(d,c){return u(b,[4,a,ae(p,d,aP(h,ah,c))],i)}}case +9:return dq(b,a,d[2],d[1],hE);case +10:var +a=[7,a],d=d[1];continue;case +11:var +a=[2,a,d[1]],d=d[2];continue;case +12:var +a=[3,a,d[1]],d=d[2];continue;case +13:var +O=d[3],P=d[2],q=eW(16);dp(q,P);var +A=eY(q);return function(c){return u(b,[4,a,A],O)};case +14:var +Q=d[3],S=d[2];return function(d){var +e=d[1],c=y(e,E(M(S)));if(typeof +c[2]==="number")return u(b,a,B(c[1],Q));throw R};case +15:var +T=d[1];return function(d,c){return u(b,[6,a,function(a){return f(d,a,c)}],T)};case +16:var +U=d[1];return function(c){return u(b,[6,a,c],U)};case +17:var +a=[0,a,d[1]],d=d[2];continue;case +18:var +m=d[1];if(0===m[0]){var +V=d[2],W=m[1][1],X=0,b=function(b,c,d){return function(a){return u(c,[1,b,[0,a]],d)}}(a,b,V),a=X,d=W;continue}var +Y=d[2],_=m[1][1],$=0,b=function(b,c,d){return function(a){return u(c,[1,b,[1,a]],d)}}(a,b,Y),a=$,d=_;continue;case +19:throw[0,t,jY];case +20:var +aa=d[3],ab=[8,a,jZ];return function(a){return u(b,ab,aa)};case +21:var +ac=d[2];return function(c){return u(b,[4,a,c8(j0,c)],ac)};case +22:var +ad=d[1];return function(c){return u(b,[5,a,c],ad)};case +23:var +g=d[2],l=d[1];if(typeof +l==="number")switch(l){case +0:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +1:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +2:throw[0,t,j1];default:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g])}else +switch(l[0]){case +0:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +1:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +2:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +3:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +4:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +5:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +6:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +7:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +8:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);case +9:var +z=l[2];return e<50?dZ(e+1|0,b,a,z,g):N(dZ,[0,b,a,z,g]);case +10:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g]);default:return e<50?x(e+1|0,b,a,g):N(x,[0,b,a,g])}default:var +r=d[3],v=d[1],w=c(d[2],0);return e<50?dY(e+1|0,b,a,r,v,w):N(dY,[0,b,a,r,v,w])}}function +dZ(e,d,c,a,b){if(typeof +a==="number")return e<50?x(e+1|0,d,c,b):N(x,[0,d,c,b]);else +switch(a[0]){case +0:var +f=a[1];return function(a){return ak(d,c,f,b)};case +1:var +g=a[1];return function(a){return ak(d,c,g,b)};case +2:var +h=a[1];return function(a){return ak(d,c,h,b)};case +3:var +i=a[1];return function(a){return ak(d,c,i,b)};case +4:var +j=a[1];return function(a){return ak(d,c,j,b)};case +5:var +k=a[1];return function(a){return ak(d,c,k,b)};case +6:var +l=a[1];return function(a){return ak(d,c,l,b)};case +7:var +m=a[1];return function(a){return ak(d,c,m,b)};case +8:var +n=a[2];return function(a){return ak(d,c,n,b)};case +9:var +o=a[3],p=a[2],q=O(M(a[1]),p);return function(a){return ak(d,c,_(q,o),b)};case +10:var +r=a[1];return function(e,a){return ak(d,c,r,b)};case +11:var +s=a[1];return function(a){return ak(d,c,s,b)};case +12:var +u=a[1];return function(a){return ak(d,c,u,b)};case +13:throw[0,t,j2];default:throw[0,t,j3]}}function +x(d,b,e,a){var +c=[8,e,j4];return d<50?b7(d+1|0,b,c,a):N(b7,[0,b,c,a])}function +dY(h,b,f,a,e,d){if(e){var +i=e[1];return function(e){return jX(b,f,a,i,c(d,e))}}var +g=[4,f,d];return h<50?b7(h+1|0,b,g,a):N(b7,[0,b,g,a])}function +u(a,b,c){return cm(b7(0,a,b,c))}function +ak(a,b,c,d){return cm(dZ(0,a,b,c,d))}function +jX(a,b,c,d,e){return cm(dY(0,a,b,c,d,e))}function +dq(f,e,d,a,b){if(typeof +a==="number")return function(a){return u(f,[4,e,c(b,a)],d)};else{if(0===a[0]){var +g=a[2],h=a[1];return function(a){return u(f,[4,e,ae(h,g,c(b,a))],d)}}var +i=a[1];return function(g,a){return u(f,[4,e,ae(i,g,c(b,a))],d)}}}function +cx(g,e,d,h,c,b,a){if(typeof +h==="number"){if(typeof +c==="number")return 0===c?function(c){return u(g,[4,e,f(b,a,c)],d)}:function(h,c){return u(g,[4,e,bu(h,f(b,a,c))],d)};var +l=c[1];return function(c){return u(g,[4,e,bu(l,f(b,a,c))],d)}}else{if(0===h[0]){var +i=h[2],j=h[1];if(typeof +c==="number")return 0===c?function(c){return u(g,[4,e,ae(j,i,f(b,a,c))],d)}:function(h,c){return u(g,[4,e,ae(j,i,bu(h,f(b,a,c)))],d)};var +m=c[1];return function(c){return u(g,[4,e,ae(j,i,bu(m,f(b,a,c)))],d)}}var +k=h[1];if(typeof +c==="number")return 0===c?function(h,c){return u(g,[4,e,ae(k,h,f(b,a,c))],d)}:function(i,h,c){return u(g,[4,e,ae(k,i,bu(h,f(b,a,c)))],d)};var +n=c[1];return function(h,c){return u(g,[4,e,ae(k,h,bu(n,f(b,a,c)))],d)}}}function +a5(b,h){var +a=h;for(;;)if(typeof +a==="number")return 0;else +switch(a[0]){case +0:var +e=a[2],i=a[1];if(typeof +e==="number")switch(e){case +0:var +d=ij;break;case +1:var +d=ik;break;case +2:var +d=il;break;case +3:var +d=im;break;case +4:var +d=io;break;case +5:var +d=ip;break;default:var +d=iq}else +switch(e[0]){case +0:var +d=e[1];break;case +1:var +d=e[1];break;default:var +d=a4(ir,eP(1,e[1]))}a5(b,i);return bR(b,d);case +1:var +f=a[2],g=a[1];if(0===f[0]){var +j=f[1];a5(b,g);bR(b,j5);var +a=j;continue}var +k=f[1];a5(b,g);bR(b,j6);var +a=k;continue;case +6:var +n=a[2];a5(b,a[1]);return bR(b,c(n,0));case +7:var +a=a[1];continue;case +8:var +o=a[2];a5(b,a[1]);return L(o);case +2:case +4:var +l=a[2];a5(b,a[1]);return bR(b,l);default:var +m=a[2];a5(b,a[1]);return eV(b,m)}}function +e0(b){var +a=b[1];return u(function(b){var +a=dl(64);a5(a,b);return eU(a)},0,a)}var +e1=[0,0];function +dr(a){e1[1]=[0,a,e1[1]];return 0}function +aC(a){return sD(10,at,0,a)}try{var +sp=dd(so),e3=sp}catch(a){a=e(a);if(a!==W)throw a;try{var +sn=dd(sm),e2=sn}catch(a){a=e(a);if(a!==W)throw a;var +e2=j8}var +e3=e2}var +j9=hZ(e3,82),cy=[d_,function(z){var +o=tk(0),c=[0,a2(55,0),0],j=0===o.length-1?[0,0]:o,k=j.length-1,b=0;for(;;){Y(c[1],b)[1+b]=b;var +y=b+1|0;if(54!==b){var +b=y;continue}var +g=[0,j7],l=54+cq(55,k)|0,u=0;if(!(l<0)){var +d=u;for(;;){var +e=d%55|0,n=s9(d,k),v=Y(j,n)[1+n],h=a4(g[1],a(i+v));g[1]=s4(h,0,s(h));var +f=g[1],p=m(f,3)<<24,q=m(f,2)<<16,r=m(f,1)<<8,t=((m(f,0)+r|0)+q|0)+p|0,w=(Y(c[1],e)[1+e]^t)&d6;Y(c[1],e)[1+e]=w;var +x=d+1|0;if(l!==d){var +d=x;continue}break}}c[2]=0;return c}}];function +j_(h,k){var +l=h?h[1]:j9,b=16;for(;;){if(!(k<=b)&&!(eK<(b*2|0))){var +b=b*2|0;continue}if(l){var +i=hs(cy),a=cT===i?cy[1]:d_===i?id(cy):cy;a[2]=(a[2]+1|0)%55|0;var +c=a[2],d=Y(a[1],c)[1+c],e=(a[2]+24|0)%55|0,f=(Y(a[1],e)[1+e]+(d^(d>>>25|0)&31)|0)&d6,g=a[2];Y(a[1],g)[1+g]=f;var +j=f}else +var +j=0;return[0,0,a2(b,0),j,b]}}var +e6=[w,j$,Q(0)],e4=0,e5=-1;function +cz(a,b){a[13]=a[13]+b[3]|0;return eT(b,a[28])}var +e7=1000000010;function +ds(b,a){return A(b[17],a,0,s(a))}function +dt(a){return c(a[19],0)}function +e8(a,c,b){a[9]=a[9]-c|0;ds(a,b);a[11]=0;return 0}function +cA(c,a){var +b=J(a,ka);return b?e8(c,s(a),a):b}function +bv(a,b,f){var +g=b[3],h=b[2];cA(a,b[1]);dt(a);a[11]=1;var +d=(a[6]-f|0)+h|0,e=a[8],i=s1(e,d)?e:d;a[10]=i;a[9]=a[6]-a[10]|0;c(a[21],a[10]);return cA(a,g)}function +e9(b,a){return bv(b,kb,a)}function +bU(a,b){var +d=b[2],e=b[3];cA(a,b[1]);a[9]=a[9]-d|0;c(a[20],d);return cA(a,e)}function +e_(a){for(;;){var +q=a[28][2],Q=q?[0,q[1]]:0;if(Q){var +o=Q[1],p=o[1],b=o[2],ac=0<=p?1:0,aa=o[3],ab=a[13]-a[12]|0,R=ac||(a[9]<=ab?1:0);if(R){var +g=a[28],r=g[2];if(r){var +t=r[2];if(t){g[1]=g[1]-1|0;g[2]=t}else +dk(g);var +j=0<=p?p:e7;if(typeof +b==="number")switch(b){case +0:var +A=bt(a[3]);if(A){var +B=A[1][1],C=function(b,a){if(a){var +c=a[1],d=a[2];return ew(b,c)?[0,b,a]:[0,c,C(b,d)]}return[0,b,0]};B[1]=C(a[6]-a[9]|0,B[1])}break;case +1:bs(a[2]);break;case +2:bs(a[3]);break;case +3:var +D=bt(a[2]);if(D)e9(a,D[1][2]);else +dt(a);break;case +4:if(a[10]!==(a[6]-a[9]|0)){var +e=a[28],k=e[2];if(k)var +u=k[1],v=k[2],l=v?(e[1]=e[1]-1|0,e[2]=v,[0,u]):(dk(e),[0,u]);else +var +l=0;if(l){var +z=l[1],T=z[1];a[12]=a[12]-z[3]|0;a[9]=a[9]+T|0}}break;default:var +E=bs(a[5]);if(E)ds(a,c(a[25],E[1]))}else +switch(b[0]){case +0:e8(a,j,b[1]);break;case +1:var +d=b[2],h=b[1],F=d[1],U=d[2],G=bt(a[2]);if(G){var +H=G[1],f=H[2];switch(H[1]){case +0:bU(a,h);break;case +1:bv(a,d,f);break;case +2:bv(a,d,f);break;case +3:if(a[9]<(j+s(F)|0))bv(a,d,f);else +bU(a,h);break;case +4:if(a[11]||!(a[9]<(j+s(F)|0)||((a[6]-f|0)+U|0)>>0))e9(a,y)}else +dt(a)}var +_=a[9]-Z|0,$=1===O?1:a[9]>>3|0,bq(bh(b,a>>>3|0)|1<<(a&7)))}function +cD(b){var +a=dy(0);bV(a,b);return a}function +cE(c){var +b=G(32),a=0;for(;;){av(b,a,bq(bh(c,a)^bx));var +d=a+1|0;if(31!==a){var +a=d;continue}return b}}function +dz(d,c){var +b=G(32),a=0;for(;;){var +e=bh(c,a);av(b,a,bq(bh(d,a)|e));var +f=a+1|0;if(31!==a){var +a=f;continue}return b}}function +lY(c,b){try{var +a=0;for(;;){var +f=bh(b,a);if(0!==(bh(c,a)&f))throw eF;var +g=a+1|0;if(31!==a){var +a=g;continue}var +d=1;return d}}catch(a){a=e(a);if(a===eF)return 0;throw a}}function +fk(f,e){var +a=0;for(;;){var +d=bh(e,a);if(0!==d){var +b=0;for(;;){if(0!==(d&1<>>0)if(9<=s)var +j=[0,[9,k+cS|0],f+1|0];else +l=1;else +if(0===s){var +I=D[1];D[1]++;var +v=E(f+1|0),p=v[2],A=0,J=v[1];if((p+1|0)>>0)){if(0===r){var +c=[5,c],d=d+1|0;continue}var +c=[6,c],d=d+1|0;continue}if(21===r){var +c=[7,c],d=d+1|0;continue}}var +B=0;if(typeof +c!=="number"&&0===c[0]){eV(h[1],c[1]);B=1}if(!B){fp(h);h[2]=[0,c,h[2]]}var +a=d;continue a}}}fp(h);return[0,[3,di(h[2])],a]}}function +E(f){var +d=F(f),c=d[1],a=d[2];for(;;){if((a+2|0)<=g&&92===m(b,a)&&eg===m(b,a+1|0)){var +e=F(a+2|0),c=[4,c,e[1]],a=e[2];continue}return[0,c,a]}}var +H=E(0),Q=H[1],I=H[2]===g?Q:a3(mk),h=[0,a2(32,0)],c=[0,0],n=[0,cH[1]],o=[0,0],j=[0,1],p=[0,0],u=0;function +a(f,e){if(h[1].length-1<=c[1]){var +a=[0,h[1].length-1];for(;;){if(a[1]<=c[1]){a[1]=a[1]*2|0;continue}var +b=a2(a[1],0);eS(h[1],0,b,0,h[1].length-1);h[1]=b;break}}var +g=fn(f,e),d=c[1];Y(h[1],d)[1+d]=g;c[1]++;return 0}function +k(d){var +b=c[1];a(cF,0);return b}function +l(a,c,b){var +d=fn(c,dB(b,a));Y(h[1],a)[1+a]=d;return 0}function +i(b){try{var +a=f(cH[27],b,n[1]);return a}catch(a){a=e(a);if(a===W){var +c=o[1];n[1]=A(cH[4],b,c,n[1]);o[1]++;return c}throw a}}function +w(b){if(dC(b)){var +a=p[1];if(64<=a)a3(mc);p[1]++;return a}return-1}function +q(b,a){return lY(b,a)}function +d(b){if(typeof +b==="number")switch(b){case +0:return a(l1,0);case +1:return a(l2,0);default:return a(l3,0)}else +switch(b[0]){case +0:return a(cF,b[1]);case +1:var +f=b[1],o=s(f);if(0===o)return 0;if(1===o)return a(cF,m(f,0));try{var +p=eR(f,0);d([1,lW(f,p)]);a(cF,0);var +x=d([1,lX(f,p+1|0)]);return x}catch(b){b=e(b);if(b===W)return a(lZ,i(f));throw b}case +2:var +q=b[1],y=b[2]?cE(q):q;return a(l0,i(cs(y)));case +3:return K(b[1]);case +4:var +z=b[2],A=b[1],B=k(0);d(A);var +C=k(0),D=c[1];d(z);var +E=c[1];l(B,cG,D);return l(C,dA,E);case +5:var +r=b[1],g=w(r),t=k(0);if(0<=g)a(fl,g);d(r);if(0<=g)a(fm,g);a(dA,dB(t,c[1]));return l(t,cG,c[1]);case +6:var +u=b[1],h=w(u),F=c[1];d(u);if(0<=h)a(fm,h);var +G=k(0);if(0<=h)a(fl,h);a(dA,dB(F,c[1]));return l(G,cG,c[1]);case +7:var +H=b[1],I=k(0);d(H);return l(I,cG,c[1]);case +8:var +n=b[1],J=b[2];a(l4,n);d(J);a(l5,n);j[1]=cq(j[1],n+1|0);return 0;default:var +v=b[1];a(l6,v);j[1]=cq(j[1],v+1|0);return 0}}function +K(o){var +b=o;for(;;){if(b){var +c=b[1];if(typeof +c!=="number")switch(c[0]){case +5:var +e=c[1],l=0;if(typeof +e==="number")l=1;else +switch(e[0]){case +0:case +2:var +h=b[2],r=bW(h);if(q(a6(e),r)){a(l9,i(dD(u,e)));var +b=h;continue}break;default:l=1}break;case +6:var +f=c[1],m=0;if(typeof +f==="number")m=1;else +switch(f[0]){case +0:case +2:var +j=b[2],s=bW(j);if(q(a6(f),s)){a(l_,i(dD(u,f)));var +b=j;continue}break;default:m=1}break;case +7:var +g=c[1],n=0;if(typeof +g==="number")n=1;else +switch(g[0]){case +0:case +2:var +k=b[2],t=bW(k);if(q(a6(g),t)){a(l8,i(dD(u,g)));var +b=k;continue}break;default:n=1}break}var +p=b[2];d(c);var +b=p;continue}return 0}}d(I);a(l7,0);var +x=a6(I);if(hd(x,aQ))var +y=-1;else{var +v=aB(bA,0);fk(function(a){return av(v,a,1)},x);var +y=i(cs(v))}var +z=a2(o[1],md),M=n[1];function +N(b,a){Y(z,a)[1+a]=b;return 0}f(cH[12],N,M);var +r=c[1],B=h[1],J=0,O=p[1],P=j[1];if(0<=r&&!((B.length-1-r|0)<0)){var +C=su(B,0,r);J=1}if(!J)var +C=L(h0);return[0,C,z,me,P,O,y]},cI=function(b,a){return Math.abs(b-a)<0.001?1:0},dG=function(b,a){return cI(b,a)?0:b>>0))switch(b){case +0:return 2;case +1:break;default:return 1}return 3}return a[1]===ab?0:4},oR=function(a){return[0,co(a[1]),a[2]]},dS=function(b,a){if(b[2]!==ab&&a[2]!==ab)return b5(bj(b[1],a[1]),bj(b[2],a[2]));return[0,aj(aN(bL(b[1]),bL(a[1]))),ab]},dT=function(a){switch(a){case +0:return 2;case +1:return 8;case +2:return 10;default:return 16}},dU=function(f,e,d,b){var +a=e;for(;;){if(d<=a)return 0;if(c(b,m(f,a)))return[0,a];var +a=a+1|0;continue}},oT=function(a){if(J(a,oU)){if(J(a,oV)){if(!J(a,oW))return fR;if(J(a,oX)){if(J(a,oY))try{var +l=eR(a,47),aa=bp(0,a,l+1|0,(s(a)-l|0)-1|0),ab=fO(bp(0,a,0,l),aa);return ab}catch(l){l=e(l);if(l===W){var +j=s(a),A=0;if(j<1)var +v=[0,0,A];else{var +R=m(a,0)+gY|0,U=0;if(!(2>>0)){var +V=0;switch(R){case +0:var +T=[0,0,1];break;case +1:V=1;break;default:var +T=[0,1,1]}if(!V){var +S=T;U=1}}if(!U)var +S=[0,0,A];var +v=S}var +c=v[2];if(j<(c+2|0))var +w=[0,2,c];else{var +$=m(a,c),h=m(a,c+1|0),u=0;if(48===$){var +i=0;if(89<=h){if(98===h)i=2;else +if(111===h)i=1;else +if(cR!==h){u=1;i=3}}else +if(66===h)i=2;else +if(79===h)i=1;else +if(!(88<=h)){u=1;i=3}switch(i){case +3:break;case +0:var +r=[0,3,c+2|0];break;case +1:var +r=[0,1,c+2|0];break;default:var +r=[0,0,c+2|0]}}else +u=1;if(u)var +r=[0,2,c];var +w=r}var +d=w[2],b=w[1],X=2===b?function(a){if(69!==a&&gH!==a)return 0;return 1}:3<=b?function(a){if(80!==a&&112!==a)return 0;return 1}:function(a){return 0},B=dU(a,d,j,X);if(B)var +C=B[1],D=C+1|0,E=tE(bp(10,a,D,j-D|0)),f=C;else +var +E=0,f=j;if(2<=b){var +F=dU(a,d,f,function(a){return 46===a?1:0});if(F){var +x=F[1];if(2===b)var +G=1;else{if(!(3<=b))throw[0,t,o0];var +G=4}var +I=x+1|0,K=f-1|0,H=0;if(K> allocations_ cat examples/allocations_familiales/securite_sociale_D.catala_fr >> allocations_familiales.catala_fr cat examples/allocations_familiales/epilogue.catala_fr >> allocations_familiales.catala_fr cat examples/allocations_familiales/tests/tests_allocations_familiales.catala_fr >> allocations_familiales.catala_fr -sed -r '/^@@Inclusion.+$/d' allocations_familiales.catala_fr > allocations_familiales_fixed.catala_fr +sed -r '/^## Inclusion.+$/d' allocations_familiales.catala_fr > allocations_familiales_fixed.catala_fr mv -f allocations_familiales_fixed.catala_fr allocations_familiales.catala_fr scp allocations_familiales.catala_fr $1/playground/ rm allocations_familiales.catala_fr scp syntax_highlighting/en/ace/mode-catala_en.js $1/playground/ scp syntax_highlighting/fr/ace/mode-catala_fr.js $1/playground/ -scp javascript/french_law.js $1/french_law.js +scp french_law_js/french_law.js $1/french_law.js diff --git a/javascript/french_law.js b/javascript/french_law.js deleted file mode 120000 index 8a6c3c76..00000000 --- a/javascript/french_law.js +++ /dev/null @@ -1 +0,0 @@ -../_build/default/src/french_law/api_web.bc.js \ No newline at end of file diff --git a/javascript/package-lock.json b/javascript/package-lock.json deleted file mode 100644 index 6a77a6dc..00000000 --- a/javascript/package-lock.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", - "requires": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, - "platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - } - } -} diff --git a/src/catala/dcalc/interpreter.ml b/src/catala/dcalc/interpreter.ml index 1c5f46e3..b4db7326 100644 --- a/src/catala/dcalc/interpreter.ml +++ b/src/catala/dcalc/interpreter.ml @@ -159,7 +159,7 @@ let rec evaluate_operator (ctx : Ast.decl_ctx) (op : A.operator Pos.marked) | A.Binop (A.Gt KDate), [ ELit (LDate i1); ELit (LDate i2) ] -> A.ELit (LBool Runtime.(i1 >@ i2)) | A.Binop (A.Gte KDate), [ ELit (LDate i1); ELit (LDate i2) ] -> - A.ELit (LBool Runtime.(i1 >@ i2)) + A.ELit (LBool Runtime.(i1 >=@ i2)) | A.Binop A.Eq, [ ELit LUnit; ELit LUnit ] -> A.ELit (LBool true) | A.Binop A.Eq, [ ELit (LDuration i1); ELit (LDuration i2) ] -> A.ELit (LBool Runtime.(i1 =^ i2)) diff --git a/src/catala/dcalc/typing.ml b/src/catala/dcalc/typing.ml index f9000d85..f1d938a7 100644 --- a/src/catala/dcalc/typing.ml +++ b/src/catala/dcalc/typing.ml @@ -59,20 +59,8 @@ let rec format_typ (ctx : Ast.decl_ctx) (fmt : Format.formatter) ~pp_sep:(fun fmt () -> Format.fprintf fmt "@ *@ ") (fun fmt t -> Format.fprintf fmt "%a" format_typ t)) ts - | TTuple (ts, Some s) -> - Format.fprintf fmt "%a @[{@ %a@ }@]" Ast.StructName.format_t s - (Format.pp_print_list - ~pp_sep:(fun fmt () -> Format.fprintf fmt ";@ ") - (fun fmt (t, f) -> - Format.fprintf fmt "%a:@ %a" Ast.StructFieldName.format_t f format_typ t)) - (List.combine ts (List.map fst (Ast.StructMap.find s ctx.ctx_structs))) - | TEnum (ts, e) -> - Format.fprintf fmt "%a [@[%a@]]" Ast.EnumName.format_t e - (Format.pp_print_list - ~pp_sep:(fun fmt () -> Format.fprintf fmt "@ |@ ") - (fun fmt (t, f) -> - Format.fprintf fmt "%a:@ %a" Ast.EnumConstructor.format_t f format_typ t)) - (List.combine ts (List.map fst (Ast.EnumMap.find e ctx.ctx_enums))) + | TTuple (_ts, Some s) -> Format.fprintf fmt "%a" Ast.StructName.format_t s + | TEnum (_ts, e) -> Format.fprintf fmt "%a" Ast.EnumName.format_t e | TArrow (t1, t2) -> Format.fprintf fmt "@[%a →@ %a@]" format_typ_with_parens t1 format_typ t2 | TArray t1 -> Format.fprintf fmt "@[%a@ array@]" format_typ t1 diff --git a/src/catala/lcalc/to_ocaml.ml b/src/catala/lcalc/to_ocaml.ml index 1fb7f95f..9c728994 100644 --- a/src/catala/lcalc/to_ocaml.ml +++ b/src/catala/lcalc/to_ocaml.ml @@ -71,7 +71,7 @@ let format_unop (fmt : Format.formatter) (op : Dcalc.Ast.unop Pos.marked) : unit match Pos.unmark op with | Minus k -> Format.fprintf fmt "~-%a" format_op_kind k | Not -> Format.fprintf fmt "%s" "not" - | ErrorOnEmpty -> Format.fprintf fmt "%s" "error_empty" + | ErrorOnEmpty -> assert false (* should not happen *) | Log (entry, infos) -> Format.fprintf fmt "@[log_entry@ \"%a|%a\"@]" format_log_entry entry (Format.pp_print_list @@ -296,6 +296,9 @@ let rec format_expr (ctx : Dcalc.Ast.decl_ctx) (fmt : Format.formatter) (e : exp | EApp ((EOp (Binop op), _), [ arg1; arg2 ]) -> Format.fprintf fmt "@[%a@ %a@ %a@]" format_with_parens arg1 format_binop (op, Pos.no_pos) format_with_parens arg2 + | EApp ((EOp (Unop D.ErrorOnEmpty), _), [ arg1 ]) -> + Format.fprintf fmt "@[try@ %a@ with@ EmptyError ->@ raise NoValueProvided@]" + format_with_parens arg1 | EApp ((EOp (Unop (D.Log _)), _), [ arg1 ]) -> Format.fprintf fmt "%a" format_with_parens arg1 | EApp ((EOp (Unop op), _), [ arg1 ]) -> Format.fprintf fmt "@[%a@ %a@]" format_unop (op, Pos.no_pos) format_with_parens arg1 diff --git a/src/catala/runtime.ml b/src/catala/runtime.ml index 0391dd9e..d3d3767b 100644 --- a/src/catala/runtime.ml +++ b/src/catala/runtime.ml @@ -24,6 +24,8 @@ type duration = CalendarLib.Date.Period.t exception EmptyError +exception NoValueProvided + exception AssertionFailed exception ConflictError @@ -127,8 +129,6 @@ let duration_to_string (d : duration) : string = let duration_to_days_months_years (d : duration) : int * int * int = CalendarLib.Date.Period.ymd d -let error_empty : 'a. 'a -> 'a = fun x -> x - let handle_default : 'a. (unit -> 'a) array -> (unit -> bool) -> (unit -> 'a) -> 'a = fun exceptions just cons -> let except = diff --git a/src/catala/runtime.mli b/src/catala/runtime.mli index a0efaf51..cd9f0287 100644 --- a/src/catala/runtime.mli +++ b/src/catala/runtime.mli @@ -36,6 +36,8 @@ exception UncomparableDurations exception ImpossibleDate +exception NoValueProvided + (**{1 Constructors and conversions} *) (**{2 Money}*) @@ -103,8 +105,6 @@ val duration_to_string : duration -> string (**{1 Defaults} *) -val error_empty : 'a -> 'a - val handle_default : (unit -> 'a) array -> (unit -> bool) -> (unit -> 'a) -> 'a (** @raise EmptyError @raise ConflictError *) diff --git a/src/catala/surface/desugaring.ml b/src/catala/surface/desugaring.ml index 0b7e93ae..45a8a2c1 100644 --- a/src/catala/surface/desugaring.ml +++ b/src/catala/surface/desugaring.ml @@ -253,7 +253,7 @@ let rec translate_expr (scope : Scopelang.Ast.ScopeName.t) (ctxt : Name_resoluti let x_possible_structs = try Desugared.Ast.IdentMap.find (Pos.unmark x) ctxt.field_idmap with Not_found -> - Errors.raise_spanned_error "This identifier should refer to a struct field" + Errors.raise_spanned_error "Unknown subscope or struct field name" (Pos.get_position x) in match c with diff --git a/src/catala/surface/parser.messages b/src/catala/surface/parser.messages index 95ac0a8f..a51c7c64 100644 --- a/src/catala/surface/parser.messages +++ b/src/catala/surface/parser.messages @@ -1852,59 +1852,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION expected an operator to compose the expression on the left with -source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION VERTICAL INT_LITERAL DIV INT_LITERAL DIV INT_LITERAL YEAR -## -## Ends in an error in state: 32. -## -## literal -> VERTICAL date_int DIV date_int DIV date_int . VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## -## The known suffix of the stack is as follows: -## VERTICAL date_int DIV date_int DIV date_int -## -expected a delimiter to finish the date literal -source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION VERTICAL INT_LITERAL DIV INT_LITERAL DIV YEAR -## -## Ends in an error in state: 31. -## -## literal -> VERTICAL date_int DIV date_int DIV . date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## -## The known suffix of the stack is as follows: -## VERTICAL date_int DIV date_int DIV -## -expected the third component of the date literal - -source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION VERTICAL INT_LITERAL DIV INT_LITERAL YEAR -## -## Ends in an error in state: 30. -## -## literal -> VERTICAL date_int DIV date_int . DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## -## The known suffix of the stack is as follows: -## VERTICAL date_int DIV date_int -## - -expected a "/" - -source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION VERTICAL INT_LITERAL DIV YEAR -## -## Ends in an error in state: 29. -## -## literal -> VERTICAL date_int DIV . date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## -## The known suffix of the stack is as follows: -## VERTICAL date_int DIV -## - -expected the second component of the date literal source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION VERTICAL INT_LITERAL YEAR ## ## Ends in an error in state: 28. ## -## literal -> VERTICAL date_int . DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## literal -> VERTICAL date_int . MINUS date_int MINUS date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int @@ -1916,7 +1872,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 26. ## -## literal -> VERTICAL . date_int DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## literal -> VERTICAL . date_int MINUS date_int MINUS date_int VERTICAL [ WITH WE_HAVE THEN SUCH SEMICOLON SCOPE RULE RSQUARE RPAREN RBRACKET PLUSMONEY PLUSDURATION PLUSDEC PLUSDATE PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDURATION MINUSDEC MINUSDATE MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DURATION LESSER_EQUAL_DEC LESSER_EQUAL_DATE LESSER_EQUAL LESSER_DURATION LESSER_DEC LESSER_DATE LESSER LABEL INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DURATION GREATER_EQUAL_DEC GREATER_EQUAL_DATE GREATER_EQUAL GREATER_DURATION GREATER_DEC GREATER_DATE GREATER FOR EXCEPTION EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL diff --git a/src/catala/surface/parser.mly b/src/catala/surface/parser.mly index 60984a6e..0375d800 100644 --- a/src/catala/surface/parser.mly +++ b/src/catala/surface/parser.mly @@ -181,11 +181,11 @@ struct_or_enum_inject: money_amount_cents = cents; }, Pos.from_lpos $sloc) } - | VERTICAL d = date_int DIV m = date_int DIV y = date_int VERTICAL { + | VERTICAL y = date_int MINUS m = date_int MINUS d = date_int VERTICAL { (LDate { - literal_date_day = (match !Utils.Cli.locale_lang with `En -> m | `Fr -> d); - literal_date_month = (match !Utils.Cli.locale_lang with `En -> d | `Fr -> m); - literal_date_year = y; + literal_date_year = y; + literal_date_month = m; + literal_date_day = d; }, Pos.from_lpos $sloc) } | TRUE { (LBool true, Pos.from_lpos $sloc) } diff --git a/src/french_law/api.ml b/src/french_law/api.ml index be5b3198..9c43196a 100644 --- a/src/french_law/api.ml +++ b/src/french_law/api.ml @@ -17,7 +17,8 @@ module AF = Allocations_familiales open Runtime let compute_allocations_familiales ~(current_date : Runtime.date) - ~(children : AF.enfant_entree array) ~(income : int) ~(residence : AF.collectivite) : float = + ~(children : AF.enfant_entree array) ~(income : int) ~(residence : AF.collectivite) + ~(is_parent : bool) ~(fills_title_I : bool) : float = let result = AF.interface_allocations_familiales { @@ -27,6 +28,8 @@ let compute_allocations_familiales ~(current_date : Runtime.date) AF.ressources_menage_in = (fun _ -> money_of_units_int income); AF.residence_in = (fun _ -> residence); AF.montant_verse_in = no_input; + AF.personne_charge_effective_permanente_est_parent_in = (fun _ -> is_parent); + AF.personne_charge_effective_permanente_remplit_titre_I_in = (fun _ -> fills_title_I); } in money_to_float result.AF.montant_verse_out diff --git a/src/french_law/api.mli b/src/french_law/api.mli index 89e2ea7f..7029633d 100644 --- a/src/french_law/api.mli +++ b/src/french_law/api.mli @@ -19,5 +19,7 @@ val compute_allocations_familiales : children:Allocations_familiales.enfant_entree array -> income:int -> residence:Allocations_familiales.collectivite -> + is_parent:bool -> + fills_title_I:bool -> float (** Usage *) diff --git a/src/french_law/api_web.ml b/src/french_law/api_web.ml index 48330f0a..63ccb4aa 100644 --- a/src/french_law/api_web.ml +++ b/src/french_law/api_web.ml @@ -29,9 +29,16 @@ class type enfant_entree = method gardeAlterneePartageAllocation : bool Js.t Js.readonly_prop - method priseEnChargeServiceSociaux : bool Js.t Js.readonly_prop + method priseEnCharge : Js.js_string Js.t Js.readonly_prop + (** Expects one of the five: - method allocationVerseeServiceSociaux : bool Js.t Js.readonly_prop + - "Effective et permanente" + - "Garde alternée, allocataire unique" + - "Garde alternée, partage des allocations" + - "Confié aux service sociaux, allocation versée à la famille" + - "Confié aux service sociaux, allocation versée aux services sociaux" *) + + method aDejaOuvertDroitAuxAllocationsFamiliales : bool Js.t Js.readonly_prop end class type allocations_familiales_input = @@ -43,6 +50,11 @@ class type allocations_familiales_input = method income : int Js.readonly_prop method residence : Js.js_string Js.t Js.readonly_prop + + method personneQuiAssumeLaChargeEffectivePermanenteEstParent : bool Js.t Js.readonly_prop + + method personneQuiAssumeLaChargeEffectivePermanenteRemplitConditionsTitreISecuriteSociale : + bool Js.t Js.readonly_prop end let _ = @@ -52,6 +64,12 @@ let _ = let result = AF.interface_allocations_familiales { + AF.personne_charge_effective_permanente_est_parent_in = + (fun _ -> Js.to_bool input##.personneQuiAssumeLaChargeEffectivePermanenteEstParent); + AF.personne_charge_effective_permanente_remplit_titre_I_in = + (fun _ -> + Js.to_bool + input##.personneQuiAssumeLaChargeEffectivePermanenteRemplitConditionsTitreISecuriteSociale); AF.date_courante_in = (fun _ -> date_of_numbers @@ -63,24 +81,27 @@ let _ = Array.map (fun (child : enfant_entree Js.t) -> { + AF.d_a_deja_ouvert_droit_aux_allocations_familiales = + Js.to_bool child##.aDejaOuvertDroitAuxAllocationsFamiliales; AF.d_identifiant = integer_of_int child##.id; AF.d_date_de_naissance = date_of_numbers child##.dateNaissance##getFullYear child##.dateNaissance##getMonth child##.dateNaissance##getDay; - AF.d_garde_alternee = - ( if Js.to_bool child##.gardeAlternee then - if Js.to_bool child##.gardeAlterneePartageAllocation then - OuiPartageAllocations () - else OuiAllocataireUnique () - else NonGardeUnique () ); - AF.d_prise_en_charge_par_services_sociaux = - ( if Js.to_bool child##.priseEnChargeServiceSociaux then - if Js.to_bool child##.allocationVerseeServiceSociaux then - OuiAllocationVerseeAuxServicesSociaux () - else OuiAllocationVerseeALaFamille () - else NonPriseEnChargeFamille () ); + AF.d_prise_en_charge = + ( match Js.to_string child##.priseEnCharge with + | "Effective et permanente" -> EffectiveEtPermanente () + | "Garde alternée, allocataire unique" -> + GardeAlterneeAllocataireUnique () + | "Garde alternée, partage des allocations" -> + GardeAlterneePartageAllocations () + | "Confié aux service sociaux, allocation versée à la famille" -> + ServicesSociauxAllocationVerseeALaFamille () + | "Confié aux service sociaux, allocation versée aux services sociaux" + -> + ServicesSociauxAllocationVerseeAuxServicesSociaux () + | _ -> failwith "Unknown prise en charge" ); AF.d_remuneration_mensuelle = money_of_units_int child##.remunerationMensuelle; }) diff --git a/src/french_law/bench.ml b/src/french_law/bench.ml index 8457a648..da08f54c 100644 --- a/src/french_law/bench.ml +++ b/src/french_law/bench.ml @@ -21,16 +21,14 @@ let random_children (id : int) = d_remuneration_mensuelle = money_of_units_int (Random.int 2000); d_date_de_naissance = date_of_numbers (2020 - Random.int 22) (1 + Random.int 12) (1 + Random.int 28); - d_garde_alternee = - ( match Random.int 3 with - | 0 -> AF.NonGardeUnique () - | 1 -> AF.OuiPartageAllocations () - | _ -> AF.OuiAllocataireUnique () ); - d_prise_en_charge_par_services_sociaux = - ( match Random.int 3 with - | 0 -> AF.OuiAllocationVerseeALaFamille () - | 1 -> AF.OuiAllocationVerseeAuxServicesSociaux () - | _ -> AF.NonPriseEnChargeFamille () ); + d_prise_en_charge = + ( match Random.int 5 with + | 0 -> AF.EffectiveEtPermanente () + | 1 -> AF.GardeAlterneePartageAllocations () + | 2 -> AF.GardeAlterneeAllocataireUnique () + | 3 -> AF.ServicesSociauxAllocationVerseeALaFamille () + | _ -> AF.ServicesSociauxAllocationVerseeAuxServicesSociaux () ); + d_a_deja_ouvert_droit_aux_allocations_familiales = true; } let format_residence (fmt : Format.formatter) (r : AF.collectivite) : unit = @@ -46,20 +44,15 @@ let format_residence (fmt : Format.formatter) (r : AF.collectivite) : unit = | AF.SaintMartin _ -> "Saint Martin" | AF.Mayotte _ -> "Mayotte" ) -let format_garde_alternee (fmt : Format.formatter) (g : AF.garde_alternee) : unit = +let format_prise_en_charge (fmt : Format.formatter) (g : AF.prise_en_charge) : unit = Format.fprintf fmt "%s" ( match g with - | AF.NonGardeUnique _ -> "Non" - | AF.OuiPartageAllocations _ -> "Oui, allocations partagée" - | AF.OuiAllocataireUnique _ -> "Oui, allocataire unique" ) - -let format_services_sociaux (fmt : Format.formatter) (g : AF.prise_en_charge_service_sociaux) : unit - = - Format.fprintf fmt "%s" - ( match g with - | AF.OuiAllocationVerseeALaFamille _ -> "Oui, allocations versée à la famille" - | AF.OuiAllocationVerseeAuxServicesSociaux _ -> "Oui, allocations versée aux services sociaux" - | AF.NonPriseEnChargeFamille _ -> "Non" ) + | AF.EffectiveEtPermanente _ -> "Effective et permanente" + | AF.GardeAlterneePartageAllocations _ -> "Garde alternée, allocations partagée" + | AF.GardeAlterneeAllocataireUnique _ -> "Garde alternée, allocataire unique" + | AF.ServicesSociauxAllocationVerseeALaFamille _ -> "Oui, allocations versée à la famille" + | AF.ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> + "Oui, allocations versée aux services sociaux" ) let num_successful = ref 0 @@ -74,24 +67,20 @@ let run_test () = try let amount = French_law.Api.compute_allocations_familiales ~current_date ~income ~residence ~children + ~is_parent:true ~fills_title_I:true in incr num_successful; total_amount := Float.add !total_amount amount with - | EmptyError -> - Format.printf "Empty error reached!\n%a\nincome: %d\ncurrent_date: %s\nresidence: %a\n" + | NoValueProvided -> + Format.printf + "No value provided somewhere!\n%a\nincome: %d\ncurrent_date: %s\nresidence: %a\n" (Format.pp_print_list (fun fmt child -> - Format.fprintf fmt - "Child %d:\n\ - \ income: %.2f\n\ - \ birth date: %s\n\ - \ garde alternée: %a\n\ - \ services sociaux: %a" + Format.fprintf fmt "Child %d:\n income: %.2f\n birth date: %s\n prise en charge: %a" (integer_to_int child.AF.d_identifiant) (money_to_float child.AF.d_remuneration_mensuelle) (Runtime.date_to_string child.AF.d_date_de_naissance) - format_garde_alternee child.AF.d_garde_alternee format_services_sociaux - child.AF.d_prise_en_charge_par_services_sociaux)) + format_prise_en_charge child.AF.d_prise_en_charge)) (Array.to_list children) income (Runtime.date_to_string current_date) format_residence residence; diff --git a/src/french_law/dune b/src/french_law/dune index 78083306..21c23684 100644 --- a/src/french_law/dune +++ b/src/french_law/dune @@ -1,24 +1,19 @@ (executable (name bench) (modes native) - (package catala) (modules bench) - (public_name benchmark_french_law) (libraries catala french_law benchmark)) (executable (name api_web) (modes byte js) - (package catala) (modules api_web) - (public_name french_law_web) (preprocess (pps js_of_ocaml-ppx)) (libraries catala law_source js_of_ocaml)) (library (name french_law) - (public_name catala.french_law) (synopsis "A collection of functions for computing French taxes and benefits derived from Catala programs") (libraries catala law_source) diff --git a/src/french_law/law_source/allocations_familiales.ml b/src/french_law/law_source/allocations_familiales.ml index 13603a8f..05556c28 100644 --- a/src/french_law/law_source/allocations_familiales.ml +++ b/src/french_law/law_source/allocations_familiales.ml @@ -4,15 +4,14 @@ open Runtime [@@@ocaml.warning "-26-27"] -type garde_alternee = - | OuiPartageAllocations of unit - | OuiAllocataireUnique of unit - | NonGardeUnique of unit +type prise_en_charge = + | GardeAlterneePartageAllocations of unit + | GardeAlterneeAllocataireUnique of unit + | EffectiveEtPermanente of unit + | ServicesSociauxAllocationVerseeALaFamille of unit + | ServicesSociauxAllocationVerseeAuxServicesSociaux of unit -type prise_en_charge_service_sociaux = - | OuiAllocationVerseeALaFamille of unit - | OuiAllocationVerseeAuxServicesSociaux of unit - | NonPriseEnChargeFamille of unit +type situation_obligation_scolaire = Avant of unit | Pendant of unit | Apres of unit type collectivite = | Guadeloupe of unit @@ -25,12 +24,10 @@ type collectivite = | SaintPierreEtMiquelon of unit | Mayotte of unit -type prise_en_compte_evaluation_montant = Complete of unit | Partagee of unit +type prise_en_compte = Complete of unit | Partagee of unit | Zero of unit type versement_allocations = Normal of unit | AllocationVerseeAuxServicesSociaux of unit -type age_alternatif = Absent of unit | Present of integer - type element_prestations_familiales = | PrestationAccueilJeuneEnfant of unit | AllocationsFamiliales of unit @@ -41,28 +38,24 @@ type element_prestations_familiales = | AllocationRentreeScolaire of unit | AllocationJournalierePresenceParentale of unit -type personne = { numero_securite_sociale : integer } - type enfant_entree = { d_identifiant : integer; d_remuneration_mensuelle : money; d_date_de_naissance : date; - d_garde_alternee : garde_alternee; - d_prise_en_charge_par_services_sociaux : prise_en_charge_service_sociaux; + d_prise_en_charge : prise_en_charge; + d_a_deja_ouvert_droit_aux_allocations_familiales : bool; } type enfant = { identifiant : integer; - fin_obligation_scolaire : date; + obligation_scolaire : situation_obligation_scolaire; remuneration_mensuelle : money; date_de_naissance : date; age : integer; - garde_alternee : garde_alternee; - prise_en_charge_par_services_sociaux : prise_en_charge_service_sociaux; + prise_en_charge : prise_en_charge; + a_deja_ouvert_droit_aux_allocations_familiales : bool; } -type stockage_enfant = PasEnfant of unit | UnEnfant of enfant - type smic_out = { date_courante_out : date; residence_out : collectivite; brut_horaire_out : money } type smic_in = { @@ -76,7 +69,6 @@ type prestations_familiales_out = { conditions_hors_age_out : enfant -> bool; plafond_l512_3_2_out : money; age_l512_3_2_out : integer; - age_l512_3_2_alternatif_out : age_alternatif; regime_outre_mer_l751_1_out : bool; date_courante_out : date; prestation_courante_out : element_prestations_familiales; @@ -89,7 +81,6 @@ type prestations_familiales_in = { conditions_hors_age_in : unit -> enfant -> bool; plafond_l512_3_2_in : unit -> money; age_l512_3_2_in : unit -> integer; - age_l512_3_2_alternatif_in : unit -> age_alternatif; regime_outre_mer_l751_1_in : unit -> bool; date_courante_in : unit -> date; prestation_courante_in : unit -> element_prestations_familiales; @@ -97,25 +88,26 @@ type prestations_familiales_in = { base_mensuelle_in : unit -> money; } -type allocation_familiales_avril2008_out = { age_limite_alinea_1_l521_3_out : integer } +type allocation_familiales_avril2008_out = { age_minimum_alinea_1_l521_3_out : integer } -type allocation_familiales_avril2008_in = { age_limite_alinea_1_l521_3_in : unit -> integer } +type allocation_familiales_avril2008_in = { age_minimum_alinea_1_l521_3_in : unit -> integer } type enfant_le_plus_age_out = { enfants_out : enfant array; le_plus_age_out : enfant } type enfant_le_plus_age_in = { enfants_in : unit -> enfant array; le_plus_age_in : unit -> enfant } type allocations_familiales_out = { + personne_charge_effective_permanente_est_parent_out : bool; + personne_charge_effective_permanente_remplit_titre_I_out : bool; + ressources_menage_out : money; + residence_out : collectivite; + date_courante_out : date; enfants_a_charge_out : enfant array; enfants_a_charge_droit_ouvert_prestation_familiale_out : enfant array; - date_courante_out : date; - residence_out : collectivite; - ressources_menage_out : money; - prise_en_compte_out : enfant -> prise_en_compte_evaluation_montant; + prise_en_compte_out : enfant -> prise_en_compte; versement_out : enfant -> versement_allocations; montant_verse_out : money; droit_ouvert_base_out : bool; - droit_ouvert_majoration_out : enfant -> bool; montant_verse_base_out : money; montant_avec_garde_alternee_base_out : money; montant_initial_base_out : money; @@ -127,6 +119,7 @@ type allocations_familiales_out = { nombre_total_enfants_out : decimal; droit_ouvert_forfaitaire_out : enfant -> bool; montant_verse_forfaitaire_out : money; + droit_ouvert_majoration_out : enfant -> bool; montant_verse_majoration_out : money; montant_avec_garde_alternee_majoration_out : enfant -> money; montant_initial_majoration_out : enfant -> money; @@ -134,10 +127,9 @@ type allocations_familiales_out = { montant_verse_complement_pour_base_et_majoration_out : money; montant_base_complement_pour_base_et_majoration_out : money; montant_verse_complement_pour_forfaitaire_out : money; - depassement_plafond_ressources_out : money -> money; - conditions_hors_age_out : enfant -> bool; + complement_degressif_out : money -> money; nombre_enfants_l521_1_out : integer; - age_limite_alinea_1_l521_3_out : enfant -> integer; + age_minimum_alinea_1_l521_3_out : enfant -> integer; nombre_enfants_alinea_2_l521_3_out : integer; est_enfant_le_plus_age_out : enfant -> bool; plafond_I_d521_3_out : money; @@ -145,16 +137,17 @@ type allocations_familiales_out = { } type allocations_familiales_in = { + personne_charge_effective_permanente_est_parent_in : unit -> bool; + personne_charge_effective_permanente_remplit_titre_I_in : unit -> bool; + ressources_menage_in : unit -> money; + residence_in : unit -> collectivite; + date_courante_in : unit -> date; enfants_a_charge_in : unit -> enfant array; enfants_a_charge_droit_ouvert_prestation_familiale_in : unit -> enfant array; - date_courante_in : unit -> date; - residence_in : unit -> collectivite; - ressources_menage_in : unit -> money; - prise_en_compte_in : unit -> enfant -> prise_en_compte_evaluation_montant; + prise_en_compte_in : unit -> enfant -> prise_en_compte; versement_in : unit -> enfant -> versement_allocations; montant_verse_in : unit -> money; droit_ouvert_base_in : unit -> bool; - droit_ouvert_majoration_in : unit -> enfant -> bool; montant_verse_base_in : unit -> money; montant_avec_garde_alternee_base_in : unit -> money; montant_initial_base_in : unit -> money; @@ -166,6 +159,7 @@ type allocations_familiales_in = { nombre_total_enfants_in : unit -> decimal; droit_ouvert_forfaitaire_in : unit -> enfant -> bool; montant_verse_forfaitaire_in : unit -> money; + droit_ouvert_majoration_in : unit -> enfant -> bool; montant_verse_majoration_in : unit -> money; montant_avec_garde_alternee_majoration_in : unit -> enfant -> money; montant_initial_majoration_in : unit -> enfant -> money; @@ -173,10 +167,9 @@ type allocations_familiales_in = { montant_verse_complement_pour_base_et_majoration_in : unit -> money; montant_base_complement_pour_base_et_majoration_in : unit -> money; montant_verse_complement_pour_forfaitaire_in : unit -> money; - depassement_plafond_ressources_in : unit -> money -> money; - conditions_hors_age_in : unit -> enfant -> bool; + complement_degressif_in : unit -> money -> money; nombre_enfants_l521_1_in : unit -> integer; - age_limite_alinea_1_l521_3_in : unit -> enfant -> integer; + age_minimum_alinea_1_l521_3_in : unit -> enfant -> integer; nombre_enfants_alinea_2_l521_3_in : unit -> integer; est_enfant_le_plus_age_in : unit -> enfant -> bool; plafond_I_d521_3_in : unit -> money; @@ -190,6 +183,8 @@ type interface_allocations_familiales_out = { ressources_menage_out : money; residence_out : collectivite; montant_verse_out : money; + personne_charge_effective_permanente_est_parent_out : bool; + personne_charge_effective_permanente_remplit_titre_I_out : bool; } type interface_allocations_familiales_in = { @@ -199,6 +194,8 @@ type interface_allocations_familiales_in = { ressources_menage_in : unit -> money; residence_in : unit -> collectivite; montant_verse_in : unit -> money; + personne_charge_effective_permanente_est_parent_in : unit -> bool; + personne_charge_effective_permanente_remplit_titre_I_in : unit -> bool; } let smic (smic_in : smic_in) = @@ -206,86 +203,89 @@ let smic (smic_in : smic_in) = let residence_ : unit -> collectivite = smic_in.residence_in in let brut_horaire_ : unit -> money = smic_in.brut_horaire_in in let date_courante_ : date = - error_empty - (handle_default - [| (fun (_ : _) -> date_courante_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> date_courante_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let residence_ : collectivite = - error_empty - (handle_default - [| (fun (_ : _) -> residence_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> residence_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let brut_horaire_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> brut_horaire_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2021 1 1 - && date_courante_ <=@ date_of_numbers 2021 12 31 - && residence_ = Mayotte ()) - (fun (_ : _) -> money_of_cents_string "774")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2021 1 1 - && date_courante_ <=@ date_of_numbers 2021 12 31 - && ( residence_ = Metropole () || residence_ = Guadeloupe () - || residence_ = Guyane () || residence_ = Martinique () - || residence_ = LaReunion () || residence_ = SaintBarthelemy () - || residence_ = SaintMartin () - || residence_ = SaintPierreEtMiquelon () )) - (fun (_ : _) -> money_of_cents_string "1025")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2020 1 1 - && date_courante_ <=@ date_of_numbers 2020 12 31 - && residence_ = Mayotte ()) - (fun (_ : _) -> money_of_cents_string "766")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2020 1 1 - && date_courante_ <=@ date_of_numbers 2020 12 31 - && ( residence_ = Metropole () || residence_ = Guadeloupe () - || residence_ = Guyane () || residence_ = Martinique () - || residence_ = LaReunion () || residence_ = SaintBarthelemy () - || residence_ = SaintMartin () - || residence_ = SaintPierreEtMiquelon () )) - (fun (_ : _) -> money_of_cents_string "1015")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2019 1 1 - && date_courante_ <=@ date_of_numbers 2019 12 31 - && residence_ = Mayotte ()) - (fun (_ : _) -> money_of_cents_string "757")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2019 1 1 - && date_courante_ <=@ date_of_numbers 2019 12 31 - && ( residence_ = Metropole () || residence_ = Guadeloupe () - || residence_ = Guyane () || residence_ = Martinique () - || residence_ = LaReunion () || residence_ = SaintBarthelemy () - || residence_ = SaintMartin () - || residence_ = SaintPierreEtMiquelon () )) - (fun (_ : _) -> money_of_cents_string "1003")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> brut_horaire_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2021 1 1 + && date_courante_ <=@ date_of_numbers 2021 12 31 + && residence_ = Mayotte ()) + (fun (_ : _) -> money_of_cents_string "774")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2021 1 1 + && date_courante_ <=@ date_of_numbers 2021 12 31 + && ( residence_ = Metropole () || residence_ = Guadeloupe () + || residence_ = Guyane () || residence_ = Martinique () + || residence_ = LaReunion () || residence_ = SaintBarthelemy () + || residence_ = SaintMartin () + || residence_ = SaintPierreEtMiquelon () )) + (fun (_ : _) -> money_of_cents_string "1025")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2020 1 1 + && date_courante_ <=@ date_of_numbers 2020 12 31 + && residence_ = Mayotte ()) + (fun (_ : _) -> money_of_cents_string "766")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2020 1 1 + && date_courante_ <=@ date_of_numbers 2020 12 31 + && ( residence_ = Metropole () || residence_ = Guadeloupe () + || residence_ = Guyane () || residence_ = Martinique () + || residence_ = LaReunion () || residence_ = SaintBarthelemy () + || residence_ = SaintMartin () + || residence_ = SaintPierreEtMiquelon () )) + (fun (_ : _) -> money_of_cents_string "1015")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2019 1 1 + && date_courante_ <=@ date_of_numbers 2019 12 31 + && residence_ = Mayotte ()) + (fun (_ : _) -> money_of_cents_string "757")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2019 1 1 + && date_courante_ <=@ date_of_numbers 2019 12 31 + && ( residence_ = Metropole () || residence_ = Guadeloupe () + || residence_ = Guyane () || residence_ = Martinique () + || residence_ = LaReunion () || residence_ = SaintBarthelemy () + || residence_ = SaintMartin () + || residence_ = SaintPierreEtMiquelon () )) + (fun (_ : _) -> money_of_cents_string "1003")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in { date_courante_out = date_courante_; @@ -295,67 +295,68 @@ let smic (smic_in : smic_in) = let allocation_familiales_avril2008 (allocation_familiales_avril2008_in : allocation_familiales_avril2008_in) = - let age_limite_alinea_1_l521_3_ : unit -> integer = - allocation_familiales_avril2008_in.age_limite_alinea_1_l521_3_in + let age_minimum_alinea_1_l521_3_ : unit -> integer = + allocation_familiales_avril2008_in.age_minimum_alinea_1_l521_3_in in - let age_limite_alinea_1_l521_3_ : integer = - error_empty - (handle_default - [| (fun (_ : _) -> age_limite_alinea_1_l521_3_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "16")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + let age_minimum_alinea_1_l521_3_ : integer = + try + handle_default + [| (fun (_ : _) -> age_minimum_alinea_1_l521_3_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "16")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in - { age_limite_alinea_1_l521_3_out = age_limite_alinea_1_l521_3_ } + { age_minimum_alinea_1_l521_3_out = age_minimum_alinea_1_l521_3_ } let enfant_le_plus_age (enfant_le_plus_age_in : enfant_le_plus_age_in) = let enfants_ : unit -> enfant array = enfant_le_plus_age_in.enfants_in in let le_plus_age_ : unit -> enfant = enfant_le_plus_age_in.le_plus_age_in in let enfants_ : enfant array = - error_empty - (handle_default - [| (fun (_ : _) -> enfants_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> enfants_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let le_plus_age_ : enfant = - error_empty - (handle_default - [| (fun (_ : _) -> le_plus_age_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - let predicate_ : _ = - fun (potentiel_plus_age_ : _) -> potentiel_plus_age_.age - in - Array.fold_left - (fun (acc_ : _) (item_ : _) -> - if predicate_ acc_ >! predicate_ item_ then acc_ else item_) - { - identifiant = ~-!(integer_of_string "1"); - fin_obligation_scolaire = date_of_numbers 1900 1 1; - remuneration_mensuelle = money_of_cents_string "0"; - date_de_naissance = date_of_numbers 1900 1 1; - age = integer_of_string "0"; - garde_alternee = NonGardeUnique (); - prise_en_charge_par_services_sociaux = NonPriseEnChargeFamille (); - } - enfants_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> le_plus_age_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + let predicate_ : _ = fun (potentiel_plus_age_ : _) -> potentiel_plus_age_.age in + Array.fold_left + (fun (acc_ : _) (item_ : _) -> + if predicate_ acc_ >! predicate_ item_ then acc_ else item_) + { + identifiant = ~-!(integer_of_string "1"); + obligation_scolaire = Pendant (); + remuneration_mensuelle = money_of_cents_string "0"; + date_de_naissance = date_of_numbers 1900 1 1; + age = integer_of_string "0"; + prise_en_charge = EffectiveEtPermanente (); + a_deja_ouvert_droit_aux_allocations_familiales = false; + } + enfants_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in { enfants_out = enfants_; le_plus_age_out = le_plus_age_ } @@ -366,9 +367,6 @@ let prestations_familiales (prestations_familiales_in : prestations_familiales_i in let plafond_l512_3_2_ : unit -> money = prestations_familiales_in.plafond_l512_3_2_in in let age_l512_3_2_ : unit -> integer = prestations_familiales_in.age_l512_3_2_in in - let age_l512_3_2_alternatif_ : unit -> age_alternatif = - prestations_familiales_in.age_l512_3_2_alternatif_in - in let regime_outre_mer_l751_1_ : unit -> bool = prestations_familiales_in.regime_outre_mer_l751_1_in in @@ -378,90 +376,72 @@ let prestations_familiales (prestations_familiales_in : prestations_familiales_i in let residence_ : unit -> collectivite = prestations_familiales_in.residence_in in let base_mensuelle_ : unit -> money = prestations_familiales_in.base_mensuelle_in in - let age_l512_3_2_alternatif_ : age_alternatif = - error_empty - (handle_default - [| (fun (_ : _) -> age_l512_3_2_alternatif_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> Absent ())); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + let age_l512_3_2_ : integer = + try + handle_default + [| (fun (_ : _) -> age_l512_3_2_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "20")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let date_courante_ : date = - error_empty - (handle_default - [| (fun (_ : _) -> date_courante_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> date_courante_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let prestation_courante_ : element_prestations_familiales = - error_empty - (handle_default - [| (fun (_ : _) -> prestation_courante_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> prestation_courante_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let residence_ : collectivite = - error_empty - (handle_default - [| (fun (_ : _) -> residence_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> residence_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let base_mensuelle_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> base_mensuelle_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2020 4 1 - && date_courante_ <@ date_of_numbers 2021 4 1) - (fun (_ : _) -> money_of_cents_string "41404")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2019 4 1 - && date_courante_ <@ date_of_numbers 2020 4 1) - (fun (_ : _) -> money_of_cents_string "41316")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) - in - let age_l512_3_2_ : integer = - error_empty - (handle_default - [| (fun (_ : _) -> age_l512_3_2_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "20")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - (match age_l512_3_2_alternatif_ with Absent _ -> false | Present _ -> true) - && ( prestation_courante_ = ComplementFamilial () - || prestation_courante_ = AllocationLogement () )) - (fun (_ : _) -> - match age_l512_3_2_alternatif_ with - | Absent _ -> integer_of_string "0" - | Present age_ -> age_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> base_mensuelle_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2020 4 1 + && date_courante_ <@ date_of_numbers 2021 4 1) + (fun (_ : _) -> money_of_cents_string "41404")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2019 4 1 + && date_courante_ <@ date_of_numbers 2020 4 1) + (fun (_ : _) -> money_of_cents_string "41316")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let smic_dot_date_courante_ : unit -> date = fun (_ : unit) -> @@ -491,97 +471,126 @@ let prestations_familiales (prestations_familiales_in : prestations_familiales_i let smic_dot_residence_ : collectivite = result_.residence_out in let smic_dot_brut_horaire_ : money = result_.brut_horaire_out in let regime_outre_mer_l751_1_ : bool = - error_empty - (handle_default - [| (fun (_ : _) -> regime_outre_mer_l751_1_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - residence_ = Guadeloupe () || residence_ = Guyane () - || residence_ = Martinique () || residence_ = LaReunion () - || residence_ = SaintBarthelemy () || residence_ = SaintMartin ()) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false))) + try + handle_default + [| (fun (_ : _) -> regime_outre_mer_l751_1_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + residence_ = Guadeloupe () || residence_ = Guyane () + || residence_ = Martinique () || residence_ = LaReunion () + || residence_ = SaintBarthelemy () || residence_ = SaintMartin ()) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided in let plafond_l512_3_2_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> plafond_l512_3_2_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> regime_outre_mer_l751_1_) - (fun (_ : _) -> - smic_dot_brut_horaire_ *$ decimal_of_string "0.55" - *$ decimal_of_string "169.")); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> - smic_dot_brut_horaire_ *$ decimal_of_string "0.55" *$ decimal_of_string "169.")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> plafond_l512_3_2_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> regime_outre_mer_l751_1_) + (fun (_ : _) -> + smic_dot_brut_horaire_ *$ decimal_of_string "0.55" + *$ decimal_of_string "169.")); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> + smic_dot_brut_horaire_ *$ decimal_of_string "0.55" *$ decimal_of_string "169.")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let conditions_hors_age_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> conditions_hors_age_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ <=@ param_.fin_obligation_scolaire - || param_.remuneration_mensuelle <=$ plafond_l512_3_2_) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false)))) + try + handle_default + [| (fun (_ : _) -> conditions_hors_age_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ( match param_.obligation_scolaire with + | Avant _ -> true + | Pendant _ -> false + | Apres _ -> false ) + || ( match param_.obligation_scolaire with + | Avant _ -> false + | Pendant _ -> true + | Apres _ -> false ) + || ( match param_.obligation_scolaire with + | Avant _ -> false + | Pendant _ -> false + | Apres _ -> true ) + && param_.remuneration_mensuelle <=$ plafond_l512_3_2_) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let droit_ouvert_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> droit_ouvert_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >@ param_.fin_obligation_scolaire - && conditions_hors_age_ param_ && param_.age true)); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> date_courante_ <=@ param_.fin_obligation_scolaire) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false)))) + try + handle_default + [| (fun (_ : _) -> droit_ouvert_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ( match param_.obligation_scolaire with + | Avant _ -> false + | Pendant _ -> false + | Apres _ -> true ) + && param_.remuneration_mensuelle <=$ plafond_l512_3_2_ + && param_.age true)); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ( match param_.obligation_scolaire with + | Avant _ -> true + | Pendant _ -> false + | Apres _ -> false ) + || + match param_.obligation_scolaire with + | Avant _ -> false + | Pendant _ -> true + | Apres _ -> false) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in { droit_ouvert_out = droit_ouvert_; conditions_hors_age_out = conditions_hors_age_; plafond_l512_3_2_out = plafond_l512_3_2_; age_l512_3_2_out = age_l512_3_2_; - age_l512_3_2_alternatif_out = age_l512_3_2_alternatif_; regime_outre_mer_l751_1_out = regime_outre_mer_l751_1_; date_courante_out = date_courante_; prestation_courante_out = prestation_courante_; @@ -590,14 +599,20 @@ let prestations_familiales (prestations_familiales_in : prestations_familiales_i } let allocations_familiales (allocations_familiales_in : allocations_familiales_in) = + let personne_charge_effective_permanente_est_parent_ : unit -> bool = + allocations_familiales_in.personne_charge_effective_permanente_est_parent_in + in + let personne_charge_effective_permanente_remplit_titre__i_ : unit -> bool = + allocations_familiales_in.personne_charge_effective_permanente_remplit_titre_I_in + in + let ressources_menage_ : unit -> money = allocations_familiales_in.ressources_menage_in in + let residence_ : unit -> collectivite = allocations_familiales_in.residence_in in + let date_courante_ : unit -> date = allocations_familiales_in.date_courante_in in let enfants_a_charge_ : unit -> enfant array = allocations_familiales_in.enfants_a_charge_in in let enfants_a_charge_droit_ouvert_prestation_familiale_ : unit -> enfant array = allocations_familiales_in.enfants_a_charge_droit_ouvert_prestation_familiale_in in - let date_courante_ : unit -> date = allocations_familiales_in.date_courante_in in - let residence_ : unit -> collectivite = allocations_familiales_in.residence_in in - let ressources_menage_ : unit -> money = allocations_familiales_in.ressources_menage_in in - let prise_en_compte_ : unit -> enfant -> prise_en_compte_evaluation_montant = + let prise_en_compte_ : unit -> enfant -> prise_en_compte = allocations_familiales_in.prise_en_compte_in in let versement_ : unit -> enfant -> versement_allocations = @@ -605,9 +620,6 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i in let montant_verse_ : unit -> money = allocations_familiales_in.montant_verse_in in let droit_ouvert_base_ : unit -> bool = allocations_familiales_in.droit_ouvert_base_in in - let droit_ouvert_majoration_ : unit -> enfant -> bool = - allocations_familiales_in.droit_ouvert_majoration_in - in let montant_verse_base_ : unit -> money = allocations_familiales_in.montant_verse_base_in in let montant_avec_garde_alternee_base_ : unit -> money = allocations_familiales_in.montant_avec_garde_alternee_base_in @@ -633,6 +645,9 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i let montant_verse_forfaitaire_ : unit -> money = allocations_familiales_in.montant_verse_forfaitaire_in in + let droit_ouvert_majoration_ : unit -> enfant -> bool = + allocations_familiales_in.droit_ouvert_majoration_in + in let montant_verse_majoration_ : unit -> money = allocations_familiales_in.montant_verse_majoration_in in @@ -654,17 +669,14 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i let montant_verse_complement_pour_forfaitaire_ : unit -> money = allocations_familiales_in.montant_verse_complement_pour_forfaitaire_in in - let depassement_plafond_ressources_ : unit -> money -> money = - allocations_familiales_in.depassement_plafond_ressources_in - in - let conditions_hors_age_ : unit -> enfant -> bool = - allocations_familiales_in.conditions_hors_age_in + let complement_degressif_ : unit -> money -> money = + allocations_familiales_in.complement_degressif_in in let nombre_enfants_l521_1_ : unit -> integer = allocations_familiales_in.nombre_enfants_l521_1_in in - let age_limite_alinea_1_l521_3_ : unit -> enfant -> integer = - allocations_familiales_in.age_limite_alinea_1_l521_3_in + let age_minimum_alinea_1_l521_3_ : unit -> enfant -> integer = + allocations_familiales_in.age_minimum_alinea_1_l521_3_in in let nombre_enfants_alinea_2_l521_3_ : unit -> integer = allocations_familiales_in.nombre_enfants_alinea_2_l521_3_in @@ -674,170 +686,225 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i in let plafond__i_d521_3_ : unit -> money = allocations_familiales_in.plafond_I_d521_3_in in let plafond__i_i_d521_3_ : unit -> money = allocations_familiales_in.plafond_II_d521_3_in in - let enfants_a_charge_ : enfant array = - error_empty - (handle_default - [| (fun (_ : _) -> enfants_a_charge_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + let personne_charge_effective_permanente_est_parent_ : bool = + try + handle_default + [| (fun (_ : _) -> personne_charge_effective_permanente_est_parent_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided in - let date_courante_ : date = - error_empty - (handle_default - [| (fun (_ : _) -> date_courante_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) - in - let residence_ : collectivite = - error_empty - (handle_default - [| (fun (_ : _) -> residence_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + let personne_charge_effective_permanente_remplit_titre__i_ : bool = + try + handle_default + [| (fun (_ : _) -> personne_charge_effective_permanente_remplit_titre__i_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided in let ressources_menage_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> ressources_menage_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> ressources_menage_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in - let prise_en_compte_ : enfant -> prise_en_compte_evaluation_montant = - error_empty - (handle_default - [| (fun (_ : _) -> prise_en_compte_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - match param_.garde_alternee with - | OuiPartageAllocations _ -> true - | OuiAllocataireUnique _ -> false - | NonGardeUnique _ -> false) - (fun (_ : _) -> Partagee ())); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - match param_.garde_alternee with - | OuiPartageAllocations _ -> false - | OuiAllocataireUnique _ -> true - | NonGardeUnique _ -> false) - (fun (_ : _) -> Complete ())); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> Complete ())); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + let residence_ : collectivite = + try + handle_default + [| (fun (_ : _) -> residence_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let date_courante_ : date = + try + handle_default + [| (fun (_ : _) -> date_courante_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let enfants_a_charge_ : enfant array = + try + handle_default + [| (fun (_ : _) -> enfants_a_charge_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let prise_en_compte_ : enfant -> prise_en_compte = + try + handle_default + [| (fun (_ : _) -> prise_en_compte_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> true + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Complete ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> true) + (fun (_ : _) -> Zero ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> true + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Partagee ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> true + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Complete ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> true + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Complete ())); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let versement_ : enfant -> versement_allocations = - error_empty - (handle_default - [| (fun (_ : _) -> versement_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - match param_.prise_en_charge_par_services_sociaux with - | OuiAllocationVerseeALaFamille _ -> false - | OuiAllocationVerseeAuxServicesSociaux _ -> true - | NonPriseEnChargeFamille _ -> false) - (fun (_ : _) -> AllocationVerseeAuxServicesSociaux ())); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - match param_.garde_alternee with - | OuiPartageAllocations _ -> true - | OuiAllocataireUnique _ -> false - | NonGardeUnique _ -> false) - (fun (_ : _) -> Normal ())); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - match param_.garde_alternee with - | OuiPartageAllocations _ -> false - | OuiAllocataireUnique _ -> true - | NonGardeUnique _ -> false) - (fun (_ : _) -> Normal ())); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> Normal ())); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + try + handle_default + [| (fun (_ : _) -> versement_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> true + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Normal ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> true) + (fun (_ : _) -> AllocationVerseeAuxServicesSociaux ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> true + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Normal ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> true + | EffectiveEtPermanente _ -> false + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Normal ())); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + match param_.prise_en_charge with + | GardeAlterneePartageAllocations _ -> false + | GardeAlterneeAllocataireUnique _ -> false + | EffectiveEtPermanente _ -> true + | ServicesSociauxAllocationVerseeALaFamille _ -> false + | ServicesSociauxAllocationVerseeAuxServicesSociaux _ -> false) + (fun (_ : _) -> Normal ())); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let nombre_enfants_l521_1_ : integer = - error_empty - (handle_default - [| (fun (_ : _) -> nombre_enfants_l521_1_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "3")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> nombre_enfants_l521_1_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "3")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let nombre_enfants_alinea_2_l521_3_ : integer = - error_empty - (handle_default - [| (fun (_ : _) -> nombre_enfants_alinea_2_l521_3_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "3")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> nombre_enfants_alinea_2_l521_3_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> integer_of_string "3")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let result_ : allocation_familiales_avril2008_out = allocation_familiales_avril2008 - { age_limite_alinea_1_l521_3_in = (fun (_ : unit) -> raise EmptyError) } + { age_minimum_alinea_1_l521_3_in = (fun (_ : unit) -> raise EmptyError) } in - let version_avril_2008_dot_age_limite_alinea_1_l521_3_ : integer = - result_.age_limite_alinea_1_l521_3_out + let version_avril_2008_dot_age_minimum_alinea_1_l521_3_ : integer = + result_.age_minimum_alinea_1_l521_3_out in - let enfant_le_plus_age_dot_enfants_ : unit -> enfant array = - fun (_ : unit) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> enfants_a_charge_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError) - in - let result_ : enfant_le_plus_age_out = - enfant_le_plus_age - { - enfants_in = enfant_le_plus_age_dot_enfants_; - le_plus_age_in = (fun (_ : unit) -> raise EmptyError); - } - in - let enfant_le_plus_age_dot_enfants_ : enfant array = result_.enfants_out in - let enfant_le_plus_age_dot_le_plus_age_ : enfant = result_.le_plus_age_out in let prestations_familiales_dot_date_courante_ : unit -> date = fun (_ : unit) -> handle_default @@ -871,7 +938,6 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i conditions_hors_age_in = (fun (_ : unit) -> raise EmptyError); plafond_l512_3_2_in = (fun (_ : unit) -> raise EmptyError); age_l512_3_2_in = (fun (_ : unit) -> raise EmptyError); - age_l512_3_2_alternatif_in = (fun (_ : unit) -> raise EmptyError); regime_outre_mer_l751_1_in = (fun (_ : unit) -> raise EmptyError); date_courante_in = prestations_familiales_dot_date_courante_; prestation_courante_in = prestations_familiales_dot_prestation_courante_; @@ -885,9 +951,6 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i in let prestations_familiales_dot_plafond_l512_3_2_ : money = result_.plafond_l512_3_2_out in let prestations_familiales_dot_age_l512_3_2_ : integer = result_.age_l512_3_2_out in - let prestations_familiales_dot_age_l512_3_2_alternatif_ : age_alternatif = - result_.age_l512_3_2_alternatif_out - in let prestations_familiales_dot_regime_outre_mer_l751_1_ : bool = result_.regime_outre_mer_l751_1_out in @@ -897,825 +960,872 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i in let prestations_familiales_dot_residence_ : collectivite = result_.residence_out in let prestations_familiales_dot_base_mensuelle_ : money = result_.base_mensuelle_out in - let est_enfant_le_plus_age_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> est_enfant_le_plus_age_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> enfant_le_plus_age_dot_le_plus_age_ = param_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + let enfant_le_plus_age_dot_enfants_ : unit -> enfant array = + fun (_ : unit) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> enfants_a_charge_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) in - let age_limite_alinea_1_l521_3_ : enfant -> integer = - error_empty - (handle_default - [| (fun (_ : _) -> age_limite_alinea_1_l521_3_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] + let result_ : enfant_le_plus_age_out = + enfant_le_plus_age + { + enfants_in = enfant_le_plus_age_dot_enfants_; + le_plus_age_in = (fun (_ : unit) -> raise EmptyError); + } + in + let enfant_le_plus_age_dot_enfants_ : enfant array = result_.enfants_out in + let enfant_le_plus_age_dot_le_plus_age_ : enfant = result_.le_plus_age_out in + let age_minimum_alinea_1_l521_3_ : enfant -> integer = + try + handle_default + [| (fun (_ : _) -> age_minimum_alinea_1_l521_3_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default + [| (fun (_ : _) -> - param_.date_de_naissance +@ duration_of_numbers 11 0 0 - <=@ date_of_numbers 2008 4 30) - (fun (_ : _) -> version_avril_2008_dot_age_limite_alinea_1_l521_3_)); - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> prestations_familiales_dot_regime_outre_mer_l751_1_) - (fun (_ : _) -> integer_of_string "11")); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> integer_of_string "14")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) - in - let conditions_hors_age_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> conditions_hors_age_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> prestations_familiales_dot_conditions_hors_age_ param_) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false)))) + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> prestations_familiales_dot_regime_outre_mer_l751_1_) + (fun (_ : _) -> integer_of_string "11")); + |] + (fun (_ : _) -> + param_.date_de_naissance +@ duration_of_numbers 11 0 0 + <=@ date_of_numbers 2008 4 30) + (fun (_ : _) -> version_avril_2008_dot_age_minimum_alinea_1_l521_3_)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> integer_of_string "14")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let enfants_a_charge_droit_ouvert_prestation_familiale_ : enfant array = - error_empty - (handle_default - [| (fun (_ : _) -> enfants_a_charge_droit_ouvert_prestation_familiale_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - array_filter - (fun (enfant_ : _) -> prestations_familiales_dot_droit_ouvert_ enfant_) - enfants_a_charge_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> enfants_a_charge_droit_ouvert_prestation_familiale_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + array_filter + (fun (enfant_ : _) -> prestations_familiales_dot_droit_ouvert_ enfant_) + enfants_a_charge_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let est_enfant_le_plus_age_ : enfant -> bool = + try + handle_default + [| (fun (_ : _) -> est_enfant_le_plus_age_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> enfant_le_plus_age_dot_le_plus_age_ = param_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let plafond__i_i_d521_3_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> plafond__i_i_d521_3_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2021 1 1 - && date_courante_ <=@ date_of_numbers 2021 12 31) - (fun (_ : _) -> - money_of_cents_string "8155800" - +$ money_of_cents_string "582700" - *$ decimal_of_integer - (array_length - enfants_a_charge_droit_ouvert_prestation_familiale_))); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2020 1 1 - && date_courante_ <=@ date_of_numbers 2020 12 31) - (fun (_ : _) -> - money_of_cents_string "8083100" - +$ money_of_cents_string "577500" - *$ decimal_of_integer - (array_length - enfants_a_charge_droit_ouvert_prestation_familiale_))); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> - money_of_cents_string "7830000" - +$ money_of_cents_string "559500" - *$ decimal_of_integer - (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> plafond__i_i_d521_3_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2021 1 1 + && date_courante_ <=@ date_of_numbers 2021 12 31) + (fun (_ : _) -> + money_of_cents_string "8155800" + +$ money_of_cents_string "582700" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2020 1 1 + && date_courante_ <=@ date_of_numbers 2020 12 31) + (fun (_ : _) -> + money_of_cents_string "8083100" + +$ money_of_cents_string "577500" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> + money_of_cents_string "7830000" + +$ money_of_cents_string "559500" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let plafond__i_d521_3_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> plafond__i_d521_3_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2021 1 1 - && date_courante_ <=@ date_of_numbers 2021 12 31) - (fun (_ : _) -> - money_of_cents_string "5827900" - +$ money_of_cents_string "582700" - *$ decimal_of_integer - (array_length - enfants_a_charge_droit_ouvert_prestation_familiale_))); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - date_courante_ >=@ date_of_numbers 2020 1 1 - && date_courante_ <=@ date_of_numbers 2020 12 31) - (fun (_ : _) -> - money_of_cents_string "5775900" - +$ money_of_cents_string "577500" - *$ decimal_of_integer - (array_length - enfants_a_charge_droit_ouvert_prestation_familiale_))); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> - money_of_cents_string "5595000" - +$ money_of_cents_string "559500" - *$ decimal_of_integer - (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> plafond__i_d521_3_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2021 1 1 + && date_courante_ <=@ date_of_numbers 2021 12 31) + (fun (_ : _) -> + money_of_cents_string "5827900" + +$ money_of_cents_string "582700" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + date_courante_ >=@ date_of_numbers 2020 1 1 + && date_courante_ <=@ date_of_numbers 2020 12 31) + (fun (_ : _) -> + money_of_cents_string "5775900" + +$ money_of_cents_string "577500" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> + money_of_cents_string "5595000" + +$ money_of_cents_string "559500" + *$ decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let droit_ouvert_complement_ : bool = - error_empty - (handle_default - [| (fun (_ : _) -> droit_ouvert_complement_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - prestations_familiales_dot_regime_outre_mer_l751_1_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> false)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false))) + try + handle_default + [| (fun (_ : _) -> droit_ouvert_complement_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + prestations_familiales_dot_regime_outre_mer_l751_1_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> false)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided in let droit_ouvert_forfaitaire_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> droit_ouvert_forfaitaire_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - prestations_familiales_dot_regime_outre_mer_l751_1_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> false)); - |] + try + handle_default + [| (fun (_ : _) -> droit_ouvert_forfaitaire_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default + [| (fun (_ : _) -> - array_length enfants_a_charge_ >=! nombre_enfants_l521_1_ - && param_.age = prestations_familiales_dot_age_l512_3_2_ - && conditions_hors_age_ param_) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false)))) + handle_default [||] + (fun (_ : _) -> + prestations_familiales_dot_regime_outre_mer_l751_1_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> false)); + |] + (fun (_ : _) -> + array_length enfants_a_charge_ >=! nombre_enfants_alinea_2_l521_3_ + && param_.age = prestations_familiales_dot_age_l512_3_2_ + && param_.a_deja_ouvert_droit_aux_allocations_familiales + && prestations_familiales_dot_conditions_hors_age_ param_) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let nombre_total_enfants_ : decimal = - error_empty - (handle_default - [| (fun (_ : _) -> nombre_total_enfants_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - decimal_of_integer - (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> nombre_total_enfants_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + decimal_of_integer + (array_length enfants_a_charge_droit_ouvert_prestation_familiale_))); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let nombre_moyen_enfants_ : decimal = - error_empty - (handle_default - [| (fun (_ : _) -> nombre_moyen_enfants_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - Array.fold_left - (fun (acc_ : decimal) (enfant_ : _) -> - acc_ - +& - match prise_en_compte_ enfant_ with - | Complete _ -> decimal_of_string "1." - | Partagee _ -> decimal_of_string "0.5") - (decimal_of_string "0.") enfants_a_charge_droit_ouvert_prestation_familiale_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) - in - let droit_ouvert_majoration_ : enfant -> bool = - error_empty - (handle_default - [| (fun (_ : _) -> droit_ouvert_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| + try + handle_default + [| (fun (_ : _) -> nombre_moyen_enfants_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! nombre_enfants_alinea_2_l521_3_ - && param_.age >=! age_limite_alinea_1_l521_3_ param_) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> - (not (est_enfant_le_plus_age_ param_)) - && param_.age >=! age_limite_alinea_1_l521_3_ param_) - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false)))) + Array.fold_left + (fun (acc_ : decimal) (enfant_ : _) -> + acc_ + +& + match prise_en_compte_ enfant_ with + | Complete _ -> decimal_of_string "1." + | Partagee _ -> decimal_of_string "0.5" + | Zero _ -> decimal_of_string "0.") + (decimal_of_string "0.") enfants_a_charge_droit_ouvert_prestation_familiale_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let droit_ouvert_base_ : bool = - error_empty - (handle_default - [| (fun (_ : _) -> droit_ouvert_base_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - prestations_familiales_dot_regime_outre_mer_l751_1_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "1") - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2") - (fun (_ : _) -> true)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> false))) - in - let depassement_plafond_ressources_ : money -> money = - error_empty - (handle_default - [| (fun (_ : _) -> depassement_plafond_ressources_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : money) -> - error_empty - (handle_default - [| + try + handle_default + [| (fun (_ : _) -> droit_ouvert_base_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + prestations_familiales_dot_regime_outre_mer_l751_1_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "1") + (fun (_ : _) -> true)); + |] (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_i_d521_3_ - && ressources_menage_ - <=$ plafond__i_i_d521_3_ +$ (param_ *$ decimal_of_string "12.")) - (fun (_ : _) -> - plafond__i_i_d521_3_ - +$ ((param_ *$ decimal_of_string "12.") -$ ressources_menage_))); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ - <=$ plafond__i_d521_3_ +$ (param_ *$ decimal_of_string "12.")) - (fun (_ : _) -> - plafond__i_d521_3_ - +$ ((param_ *$ decimal_of_string "12.") -$ ressources_menage_))); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2") + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided + in + let droit_ouvert_majoration_ : enfant -> bool = + try + handle_default + [| (fun (_ : _) -> droit_ouvert_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! nombre_enfants_alinea_2_l521_3_ + && param_.age >=! age_minimum_alinea_1_l521_3_ param_) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> + (not (est_enfant_le_plus_age_ param_)) + && param_.age >=! age_minimum_alinea_1_l521_3_ param_) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided + in + let complement_degressif_ : money -> money = + try + handle_default + [| (fun (_ : _) -> complement_degressif_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : money) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_i_d521_3_ + && ressources_menage_ + <=$ plafond__i_i_d521_3_ +$ (param_ *$ decimal_of_string "12.")) + (fun (_ : _) -> + ( plafond__i_i_d521_3_ + +$ ((param_ *$ decimal_of_string "12.") -$ ressources_menage_) ) + *$ (decimal_of_string "1." /& decimal_of_string "12."))); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ + <=$ plafond__i_d521_3_ +$ (param_ *$ decimal_of_string "12.")) + (fun (_ : _) -> + ( plafond__i_d521_3_ + +$ ((param_ *$ decimal_of_string "12.") -$ ressources_menage_) ) + *$ (decimal_of_string "1." /& decimal_of_string "12."))); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let montant_initial_base_troisieme_enfant_et_plus_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_initial_base_troisieme_enfant_et_plus_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "3" - then - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.1025" - *$ decimal_of_integer - ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - -! integer_of_string "2" ) - else money_of_cents_string "0")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ <=$ plafond__i_i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "3" - then - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.205" - *$ decimal_of_integer - ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - -! integer_of_string "2" ) - else money_of_cents_string "0")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "3" - then - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.41" - *$ decimal_of_integer - ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - -! integer_of_string "2" ) - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_initial_base_troisieme_enfant_et_plus_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "3" + then + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.1025" + *$ decimal_of_integer + ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + -! integer_of_string "2" ) + else money_of_cents_string "0")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ <=$ plafond__i_i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "3" + then + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.205" + *$ decimal_of_integer + ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + -! integer_of_string "2" ) + else money_of_cents_string "0")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "3" + then + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.41" + *$ decimal_of_integer + ( array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + -! integer_of_string "2" ) + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_initial_base_deuxieme_enfant_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_initial_base_deuxieme_enfant_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2" - then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.08" - else money_of_cents_string "0")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ <=$ plafond__i_i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2" - then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.32" - else money_of_cents_string "0")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) - (fun (_ : _) -> - if - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2" - then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.32" - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_initial_base_deuxieme_enfant_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2" + then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.08" + else money_of_cents_string "0")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ <=$ plafond__i_i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2" + then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.16" + else money_of_cents_string "0")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) + (fun (_ : _) -> + if + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2" + then prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.32" + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_initial_base_premier_enfant_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_initial_base_premier_enfant_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588" - *$ decimal_of_string "0.25")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ <=$ plafond__i_i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588" - *$ decimal_of_string "0.5")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ <=$ plafond__i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - <> integer_of_string "1") - (fun (_ : _) -> money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_initial_base_premier_enfant_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588" + *$ decimal_of_string "0.25")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ <=$ plafond__i_i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588" + *$ decimal_of_string "0.5")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ <=$ plafond__i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0588")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + <> integer_of_string "1") + (fun (_ : _) -> money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_forfaitaire_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_forfaitaire_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0559" - *$ decimal_of_integer - (Array.fold_left - (fun (acc_ : integer) (enfant_ : _) -> - if droit_ouvert_forfaitaire_ enfant_ then - acc_ +! integer_of_string "1" - else acc_) - (integer_of_string "0") enfants_a_charge_))); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ <=$ plafond__i_i_d521_3_) - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.1117" - *$ decimal_of_integer - (Array.fold_left - (fun (acc_ : integer) (enfant_ : _) -> - if droit_ouvert_forfaitaire_ enfant_ then - acc_ +! integer_of_string "1" - else acc_) - (integer_of_string "0") enfants_a_charge_))); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.20234" - *$ decimal_of_integer - (Array.fold_left - (fun (acc_ : integer) (enfant_ : _) -> - if droit_ouvert_forfaitaire_ enfant_ then - acc_ +! integer_of_string "1" - else acc_) - (integer_of_string "0") enfants_a_charge_))); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_forfaitaire_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ >$ plafond__i_i_d521_3_) + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.0559" + *$ decimal_of_integer + (Array.fold_left + (fun (acc_ : integer) (enfant_ : _) -> + if droit_ouvert_forfaitaire_ enfant_ then + acc_ +! integer_of_string "1" + else acc_) + (integer_of_string "0") enfants_a_charge_))); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ <=$ plafond__i_i_d521_3_) + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.1117" + *$ decimal_of_integer + (Array.fold_left + (fun (acc_ : integer) (enfant_ : _) -> + if droit_ouvert_forfaitaire_ enfant_ then + acc_ +! integer_of_string "1" + else acc_) + (integer_of_string "0") enfants_a_charge_))); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> ressources_menage_ <=$ plafond__i_d521_3_) + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.20234" + *$ decimal_of_integer + (Array.fold_left + (fun (acc_ : integer) (enfant_ : _) -> + if droit_ouvert_forfaitaire_ enfant_ then + acc_ +! integer_of_string "1" + else acc_) + (integer_of_string "0") enfants_a_charge_))); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let rapport_enfants_total_moyen_ : decimal = - error_empty - (handle_default - [| (fun (_ : _) -> rapport_enfants_total_moyen_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if nombre_total_enfants_ = decimal_of_string "0." then decimal_of_string "0." - else nombre_moyen_enfants_ /& nombre_total_enfants_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> rapport_enfants_total_moyen_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if nombre_total_enfants_ = decimal_of_string "0." then decimal_of_string "0." + else nombre_moyen_enfants_ /& nombre_total_enfants_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_initial_majoration_ : enfant -> money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_initial_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> not (droit_ouvert_majoration_ param_)) - (fun (_ : _) -> money_of_cents_string "0")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - droit_ouvert_majoration_ param_ - && prestations_familiales_dot_regime_outre_mer_l751_1_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ - *$ - if param_.age >=! integer_of_string "16" then decimal_of_string "0.0567" - else decimal_of_string "0.0369")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - droit_ouvert_majoration_ param_ - && ressources_menage_ >$ plafond__i_i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.04")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - droit_ouvert_majoration_ param_ - && ressources_menage_ >$ plafond__i_d521_3_ - && ressources_menage_ <=$ plafond__i_i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.08")); - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - droit_ouvert_majoration_ param_ - && ressources_menage_ <=$ plafond__i_d521_3_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - >=! integer_of_string "2") - (fun (_ : _) -> - prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.16")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + try + handle_default + [| (fun (_ : _) -> montant_initial_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> not (droit_ouvert_majoration_ param_)) + (fun (_ : _) -> money_of_cents_string "0")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + droit_ouvert_majoration_ param_ + && prestations_familiales_dot_regime_outre_mer_l751_1_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ + *$ + if param_.age >=! integer_of_string "16" then decimal_of_string "0.0567" + else decimal_of_string "0.0369")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + droit_ouvert_majoration_ param_ + && ressources_menage_ >$ plafond__i_i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.04")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + droit_ouvert_majoration_ param_ + && ressources_menage_ >$ plafond__i_d521_3_ + && ressources_menage_ <=$ plafond__i_i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.08")); + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + droit_ouvert_majoration_ param_ + && ressources_menage_ <=$ plafond__i_d521_3_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + >=! integer_of_string "2") + (fun (_ : _) -> + prestations_familiales_dot_base_mensuelle_ *$ decimal_of_string "0.16")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let montant_initial_base_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_initial_base_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> - prestations_familiales_dot_regime_outre_mer_l751_1_ - && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ - = integer_of_string "1") - (fun (_ : _) -> montant_initial_base_premier_enfant_)); - |] - (fun (_ : _) -> true) - (fun (_ : _) -> - montant_initial_base_deuxieme_enfant_ - +$ montant_initial_base_troisieme_enfant_et_plus_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_initial_base_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> + prestations_familiales_dot_regime_outre_mer_l751_1_ + && array_length enfants_a_charge_droit_ouvert_prestation_familiale_ + = integer_of_string "1") + (fun (_ : _) -> montant_initial_base_premier_enfant_)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> + montant_initial_base_deuxieme_enfant_ + +$ montant_initial_base_troisieme_enfant_et_plus_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_complement_pour_forfaitaire_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_complement_pour_forfaitaire_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if droit_ouvert_complement_ then - depassement_plafond_ressources_ montant_verse_forfaitaire_ - *$ (decimal_of_string "1." /& decimal_of_string "12.") - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_complement_pour_forfaitaire_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if droit_ouvert_complement_ then + complement_degressif_ montant_verse_forfaitaire_ + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_avec_garde_alternee_majoration_ : enfant -> money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_avec_garde_alternee_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) (param_ : enfant) -> - error_empty - (handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - montant_initial_majoration_ param_ - *$ - match prise_en_compte_ param_ with - | Complete _ -> decimal_of_string "1." - | Partagee _ -> decimal_of_string "0.5")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError)))) + try + handle_default + [| (fun (_ : _) -> montant_avec_garde_alternee_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) (param_ : enfant) -> + try + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + montant_initial_majoration_ param_ + *$ + match prise_en_compte_ param_ with + | Complete _ -> decimal_of_string "1." + | Partagee _ -> decimal_of_string "0.5" + | Zero _ -> decimal_of_string "0.")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + with EmptyError -> raise NoValueProvided) + with EmptyError -> raise NoValueProvided in let montant_avec_garde_alternee_base_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_avec_garde_alternee_base_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> montant_initial_base_ *$ rapport_enfants_total_moyen_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_avec_garde_alternee_base_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> montant_initial_base_ *$ rapport_enfants_total_moyen_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_majoration_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if droit_ouvert_base_ then - Array.fold_left - (fun (acc_ : money) (enfant_ : _) -> - acc_ +$ montant_avec_garde_alternee_majoration_ enfant_) - (money_of_cents_string "0") enfants_a_charge_ - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if droit_ouvert_base_ then + Array.fold_left + (fun (acc_ : money) (enfant_ : _) -> + acc_ +$ montant_avec_garde_alternee_majoration_ enfant_) + (money_of_cents_string "0") enfants_a_charge_ + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_base_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_base_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if droit_ouvert_base_ then montant_avec_garde_alternee_base_ - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_base_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if droit_ouvert_base_ then montant_avec_garde_alternee_base_ + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_base_complement_pour_base_et_majoration_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_base_complement_pour_base_et_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> montant_verse_base_ +$ montant_verse_majoration_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_base_complement_pour_base_et_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> montant_verse_base_ +$ montant_verse_majoration_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_complement_pour_base_et_majoration_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_complement_pour_base_et_majoration_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if droit_ouvert_complement_ then - depassement_plafond_ressources_ - montant_base_complement_pour_base_et_majoration_ - *$ (decimal_of_string "1." /& decimal_of_string "12.") - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_complement_pour_base_et_majoration_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if droit_ouvert_complement_ then + complement_degressif_ montant_base_complement_pour_base_et_majoration_ + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let montant_verse_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - if droit_ouvert_base_ then - montant_verse_base_ - +$ ( montant_verse_majoration_ - +$ ( montant_verse_forfaitaire_ - +$ ( montant_verse_complement_pour_base_et_majoration_ - +$ montant_verse_complement_pour_forfaitaire_ ) ) ) - else money_of_cents_string "0")); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> montant_verse_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + if droit_ouvert_base_ then + montant_verse_base_ + +$ ( montant_verse_majoration_ + +$ ( montant_verse_forfaitaire_ + +$ ( montant_verse_complement_pour_base_et_majoration_ + +$ montant_verse_complement_pour_forfaitaire_ ) ) ) + else money_of_cents_string "0")); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let (_ : unit) = + if + personne_charge_effective_permanente_est_parent_ + || (not personne_charge_effective_permanente_est_parent_) + && personne_charge_effective_permanente_remplit_titre__i_ + then () + else raise AssertionFailed in { + personne_charge_effective_permanente_est_parent_out = + personne_charge_effective_permanente_est_parent_; + personne_charge_effective_permanente_remplit_titre_I_out = + personne_charge_effective_permanente_remplit_titre__i_; + ressources_menage_out = ressources_menage_; + residence_out = residence_; + date_courante_out = date_courante_; enfants_a_charge_out = enfants_a_charge_; enfants_a_charge_droit_ouvert_prestation_familiale_out = enfants_a_charge_droit_ouvert_prestation_familiale_; - date_courante_out = date_courante_; - residence_out = residence_; - ressources_menage_out = ressources_menage_; prise_en_compte_out = prise_en_compte_; versement_out = versement_; montant_verse_out = montant_verse_; droit_ouvert_base_out = droit_ouvert_base_; - droit_ouvert_majoration_out = droit_ouvert_majoration_; montant_verse_base_out = montant_verse_base_; montant_avec_garde_alternee_base_out = montant_avec_garde_alternee_base_; montant_initial_base_out = montant_initial_base_; @@ -1728,6 +1838,7 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i nombre_total_enfants_out = nombre_total_enfants_; droit_ouvert_forfaitaire_out = droit_ouvert_forfaitaire_; montant_verse_forfaitaire_out = montant_verse_forfaitaire_; + droit_ouvert_majoration_out = droit_ouvert_majoration_; montant_verse_majoration_out = montant_verse_majoration_; montant_avec_garde_alternee_majoration_out = montant_avec_garde_alternee_majoration_; montant_initial_majoration_out = montant_initial_majoration_; @@ -1737,10 +1848,9 @@ let allocations_familiales (allocations_familiales_in : allocations_familiales_i montant_base_complement_pour_base_et_majoration_out = montant_base_complement_pour_base_et_majoration_; montant_verse_complement_pour_forfaitaire_out = montant_verse_complement_pour_forfaitaire_; - depassement_plafond_ressources_out = depassement_plafond_ressources_; - conditions_hors_age_out = conditions_hors_age_; + complement_degressif_out = complement_degressif_; nombre_enfants_l521_1_out = nombre_enfants_l521_1_; - age_limite_alinea_1_l521_3_out = age_limite_alinea_1_l521_3_; + age_minimum_alinea_1_l521_3_out = age_minimum_alinea_1_l521_3_; nombre_enfants_alinea_2_l521_3_out = nombre_enfants_alinea_2_l521_3_; est_enfant_le_plus_age_out = est_enfant_le_plus_age_; plafond_I_d521_3_out = plafond__i_d521_3_; @@ -1759,78 +1869,145 @@ let interface_allocations_familiales in let residence_ : unit -> collectivite = interface_allocations_familiales_in.residence_in in let montant_verse_ : unit -> money = interface_allocations_familiales_in.montant_verse_in in + let personne_charge_effective_permanente_est_parent_ : unit -> bool = + interface_allocations_familiales_in.personne_charge_effective_permanente_est_parent_in + in + let personne_charge_effective_permanente_remplit_titre__i_ : unit -> bool = + interface_allocations_familiales_in.personne_charge_effective_permanente_remplit_titre_I_in + in let date_courante_ : date = - error_empty - (handle_default - [| (fun (_ : _) -> date_courante_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> date_courante_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let enfants_ : enfant_entree array = - error_empty - (handle_default - [| (fun (_ : _) -> enfants_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> enfants_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let ressources_menage_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> ressources_menage_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> ressources_menage_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in let residence_ : collectivite = - error_empty - (handle_default - [| (fun (_ : _) -> residence_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> residence_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided + in + let personne_charge_effective_permanente_est_parent_ : bool = + try + handle_default + [| (fun (_ : _) -> personne_charge_effective_permanente_est_parent_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided + in + let personne_charge_effective_permanente_remplit_titre__i_ : bool = + try + handle_default + [| (fun (_ : _) -> personne_charge_effective_permanente_remplit_titre__i_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> false)) + with EmptyError -> raise NoValueProvided in let enfants_a_charge_ : enfant array = - error_empty - (handle_default - [| (fun (_ : _) -> enfants_a_charge_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> - Array.map - (fun (enfant_ : _) -> - { - identifiant = enfant_.d_identifiant; - fin_obligation_scolaire = - enfant_.d_date_de_naissance +@ duration_of_numbers 16 0 0; - remuneration_mensuelle = enfant_.d_remuneration_mensuelle; - date_de_naissance = enfant_.d_date_de_naissance; - age = - year_of_date - ( date_of_numbers 0 1 1 - +@ (date_courante_ -@ enfant_.d_date_de_naissance) ); - garde_alternee = enfant_.d_garde_alternee; - prise_en_charge_par_services_sociaux = - enfant_.d_prise_en_charge_par_services_sociaux; - }) - enfants_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) + try + handle_default + [| (fun (_ : _) -> enfants_a_charge_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> + Array.map + (fun (enfant_ : _) -> + { + identifiant = enfant_.d_identifiant; + obligation_scolaire = + ( if + enfant_.d_date_de_naissance +@ duration_of_numbers 3 0 0 + >=@ date_courante_ + then Avant () + else if + enfant_.d_date_de_naissance +@ duration_of_numbers 16 0 0 + >=@ date_courante_ + then Pendant () + else Apres () ); + remuneration_mensuelle = enfant_.d_remuneration_mensuelle; + date_de_naissance = enfant_.d_date_de_naissance; + age = + year_of_date + ( date_of_numbers 0 1 1 + +@ (date_courante_ -@ enfant_.d_date_de_naissance) ); + prise_en_charge = enfant_.d_prise_en_charge; + a_deja_ouvert_droit_aux_allocations_familiales = + enfant_.d_a_deja_ouvert_droit_aux_allocations_familiales; + }) + enfants_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in - let allocations_familiales_dot_enfants_a_charge_ : unit -> enfant array = + let allocations_familiales_dot_personne_charge_effective_permanente_est_parent_ : unit -> bool = fun (_ : unit) -> handle_default [| (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> enfants_a_charge_)); + handle_default [||] + (fun (_ : _) -> personne_charge_effective_permanente_est_parent_) + (fun (_ : _) -> true)); |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + in + let allocations_familiales_dot_personne_charge_effective_permanente_remplit_titre__i_ : + unit -> bool = + fun (_ : unit) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> personne_charge_effective_permanente_remplit_titre__i_) + (fun (_ : _) -> true)); + |] + (fun (_ : _) -> true) + (fun (_ : _) -> false) + in + let allocations_familiales_dot_ressources_menage_ : unit -> money = + fun (_ : unit) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> ressources_menage_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError) + in + let allocations_familiales_dot_residence_ : unit -> collectivite = + fun (_ : unit) -> + handle_default + [| (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> residence_)) |] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError) in @@ -1843,19 +2020,12 @@ let interface_allocations_familiales (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError) in - let allocations_familiales_dot_residence_ : unit -> collectivite = - fun (_ : unit) -> - handle_default - [| (fun (_ : _) -> handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> residence_)) |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError) - in - let allocations_familiales_dot_ressources_menage_ : unit -> money = + let allocations_familiales_dot_enfants_a_charge_ : unit -> enfant array = fun (_ : unit) -> handle_default [| (fun (_ : _) -> - handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> ressources_menage_)); + handle_default [||] (fun (_ : _) -> true) (fun (_ : _) -> enfants_a_charge_)); |] (fun (_ : _) -> false) (fun (_ : _) -> raise EmptyError) @@ -1863,16 +2033,19 @@ let interface_allocations_familiales let result_ : allocations_familiales_out = allocations_familiales { + personne_charge_effective_permanente_est_parent_in = + allocations_familiales_dot_personne_charge_effective_permanente_est_parent_; + personne_charge_effective_permanente_remplit_titre_I_in = + allocations_familiales_dot_personne_charge_effective_permanente_remplit_titre__i_; + ressources_menage_in = allocations_familiales_dot_ressources_menage_; + residence_in = allocations_familiales_dot_residence_; + date_courante_in = allocations_familiales_dot_date_courante_; enfants_a_charge_in = allocations_familiales_dot_enfants_a_charge_; enfants_a_charge_droit_ouvert_prestation_familiale_in = (fun (_ : unit) -> raise EmptyError); - date_courante_in = allocations_familiales_dot_date_courante_; - residence_in = allocations_familiales_dot_residence_; - ressources_menage_in = allocations_familiales_dot_ressources_menage_; prise_en_compte_in = (fun (_ : unit) -> raise EmptyError); versement_in = (fun (_ : unit) -> raise EmptyError); montant_verse_in = (fun (_ : unit) -> raise EmptyError); droit_ouvert_base_in = (fun (_ : unit) -> raise EmptyError); - droit_ouvert_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_verse_base_in = (fun (_ : unit) -> raise EmptyError); montant_avec_garde_alternee_base_in = (fun (_ : unit) -> raise EmptyError); montant_initial_base_in = (fun (_ : unit) -> raise EmptyError); @@ -1884,6 +2057,7 @@ let interface_allocations_familiales nombre_total_enfants_in = (fun (_ : unit) -> raise EmptyError); droit_ouvert_forfaitaire_in = (fun (_ : unit) -> raise EmptyError); montant_verse_forfaitaire_in = (fun (_ : unit) -> raise EmptyError); + droit_ouvert_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_verse_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_avec_garde_alternee_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_initial_majoration_in = (fun (_ : unit) -> raise EmptyError); @@ -1891,25 +2065,30 @@ let interface_allocations_familiales montant_verse_complement_pour_base_et_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_base_complement_pour_base_et_majoration_in = (fun (_ : unit) -> raise EmptyError); montant_verse_complement_pour_forfaitaire_in = (fun (_ : unit) -> raise EmptyError); - depassement_plafond_ressources_in = (fun (_ : unit) -> raise EmptyError); - conditions_hors_age_in = (fun (_ : unit) -> raise EmptyError); + complement_degressif_in = (fun (_ : unit) -> raise EmptyError); nombre_enfants_l521_1_in = (fun (_ : unit) -> raise EmptyError); - age_limite_alinea_1_l521_3_in = (fun (_ : unit) -> raise EmptyError); + age_minimum_alinea_1_l521_3_in = (fun (_ : unit) -> raise EmptyError); nombre_enfants_alinea_2_l521_3_in = (fun (_ : unit) -> raise EmptyError); est_enfant_le_plus_age_in = (fun (_ : unit) -> raise EmptyError); plafond_I_d521_3_in = (fun (_ : unit) -> raise EmptyError); plafond_II_d521_3_in = (fun (_ : unit) -> raise EmptyError); } in + let allocations_familiales_dot_personne_charge_effective_permanente_est_parent_ : bool = + result_.personne_charge_effective_permanente_est_parent_out + in + let allocations_familiales_dot_personne_charge_effective_permanente_remplit_titre__i_ : bool = + result_.personne_charge_effective_permanente_remplit_titre_I_out + in + let allocations_familiales_dot_ressources_menage_ : money = result_.ressources_menage_out in + let allocations_familiales_dot_residence_ : collectivite = result_.residence_out in + let allocations_familiales_dot_date_courante_ : date = result_.date_courante_out in let allocations_familiales_dot_enfants_a_charge_ : enfant array = result_.enfants_a_charge_out in let allocations_familiales_dot_enfants_a_charge_droit_ouvert_prestation_familiale_ : enfant array = result_.enfants_a_charge_droit_ouvert_prestation_familiale_out in - let allocations_familiales_dot_date_courante_ : date = result_.date_courante_out in - let allocations_familiales_dot_residence_ : collectivite = result_.residence_out in - let allocations_familiales_dot_ressources_menage_ : money = result_.ressources_menage_out in - let allocations_familiales_dot_prise_en_compte_ : enfant -> prise_en_compte_evaluation_montant = + let allocations_familiales_dot_prise_en_compte_ : enfant -> prise_en_compte = result_.prise_en_compte_out in let allocations_familiales_dot_versement_ : enfant -> versement_allocations = @@ -1917,9 +2096,6 @@ let interface_allocations_familiales in let allocations_familiales_dot_montant_verse_ : money = result_.montant_verse_out in let allocations_familiales_dot_droit_ouvert_base_ : bool = result_.droit_ouvert_base_out in - let allocations_familiales_dot_droit_ouvert_majoration_ : enfant -> bool = - result_.droit_ouvert_majoration_out - in let allocations_familiales_dot_montant_verse_base_ : money = result_.montant_verse_base_out in let allocations_familiales_dot_montant_avec_garde_alternee_base_ : money = result_.montant_avec_garde_alternee_base_out @@ -1949,6 +2125,9 @@ let interface_allocations_familiales let allocations_familiales_dot_montant_verse_forfaitaire_ : money = result_.montant_verse_forfaitaire_out in + let allocations_familiales_dot_droit_ouvert_majoration_ : enfant -> bool = + result_.droit_ouvert_majoration_out + in let allocations_familiales_dot_montant_verse_majoration_ : money = result_.montant_verse_majoration_out in @@ -1970,17 +2149,14 @@ let interface_allocations_familiales let allocations_familiales_dot_montant_verse_complement_pour_forfaitaire_ : money = result_.montant_verse_complement_pour_forfaitaire_out in - let allocations_familiales_dot_depassement_plafond_ressources_ : money -> money = - result_.depassement_plafond_ressources_out - in - let allocations_familiales_dot_conditions_hors_age_ : enfant -> bool = - result_.conditions_hors_age_out + let allocations_familiales_dot_complement_degressif_ : money -> money = + result_.complement_degressif_out in let allocations_familiales_dot_nombre_enfants_l521_1_ : integer = result_.nombre_enfants_l521_1_out in - let allocations_familiales_dot_age_limite_alinea_1_l521_3_ : enfant -> integer = - result_.age_limite_alinea_1_l521_3_out + let allocations_familiales_dot_age_minimum_alinea_1_l521_3_ : enfant -> integer = + result_.age_minimum_alinea_1_l521_3_out in let allocations_familiales_dot_nombre_enfants_alinea_2_l521_3_ : integer = result_.nombre_enfants_alinea_2_l521_3_out @@ -1991,32 +2167,21 @@ let interface_allocations_familiales let allocations_familiales_dot_plafond__i_d521_3_ : money = result_.plafond_I_d521_3_out in let allocations_familiales_dot_plafond__i_i_d521_3_ : money = result_.plafond_II_d521_3_out in let montant_verse_ : money = - error_empty - (handle_default - [| (fun (_ : _) -> montant_verse_ ()) |] - (fun (_ : _) -> true) - (fun (_ : _) -> - handle_default - [| - (fun (_ : _) -> - handle_default [||] - (fun (_ : _) -> true) - (fun (_ : _) -> allocations_familiales_dot_montant_verse_)); - |] - (fun (_ : _) -> false) - (fun (_ : _) -> raise EmptyError))) - in - let (_ : unit) = - if - not - (Array.fold_left - (fun (acc_ : bool) (enfant_ : _) -> - acc_ - || enfant_.d_garde_alternee <> NonGardeUnique () - && enfant_.d_prise_en_charge_par_services_sociaux <> NonPriseEnChargeFamille ()) - false enfants_) - then () - else raise AssertionFailed + try + handle_default + [| (fun (_ : _) -> montant_verse_ ()) |] + (fun (_ : _) -> true) + (fun (_ : _) -> + handle_default + [| + (fun (_ : _) -> + handle_default [||] + (fun (_ : _) -> true) + (fun (_ : _) -> allocations_familiales_dot_montant_verse_)); + |] + (fun (_ : _) -> false) + (fun (_ : _) -> raise EmptyError)) + with EmptyError -> raise NoValueProvided in { date_courante_out = date_courante_; @@ -2025,4 +2190,8 @@ let interface_allocations_familiales ressources_menage_out = ressources_menage_; residence_out = residence_; montant_verse_out = montant_verse_; + personne_charge_effective_permanente_est_parent_out = + personne_charge_effective_permanente_est_parent_; + personne_charge_effective_permanente_remplit_titre_I_out = + personne_charge_effective_permanente_remplit_titre__i_; } diff --git a/src/french_law/law_source/allocations_familiales.mli b/src/french_law/law_source/allocations_familiales.mli index f0393ba6..c91405fb 100644 --- a/src/french_law/law_source/allocations_familiales.mli +++ b/src/french_law/law_source/allocations_familiales.mli @@ -12,15 +12,16 @@ or implied. See the License for the specific language governing permissions and limitations under the License. *) -type garde_alternee = - | OuiPartageAllocations of unit - | OuiAllocataireUnique of unit - | NonGardeUnique of unit +open Runtime -type prise_en_charge_service_sociaux = - | OuiAllocationVerseeALaFamille of unit - | OuiAllocationVerseeAuxServicesSociaux of unit - | NonPriseEnChargeFamille of unit +type prise_en_charge = + | GardeAlterneePartageAllocations of unit + | GardeAlterneeAllocataireUnique of unit + | EffectiveEtPermanente of unit + | ServicesSociauxAllocationVerseeALaFamille of unit + | ServicesSociauxAllocationVerseeAuxServicesSociaux of unit + +type situation_obligation_scolaire = Avant of unit | Pendant of unit | Apres of unit type collectivite = | Guadeloupe of unit @@ -33,12 +34,6 @@ type collectivite = | SaintPierreEtMiquelon of unit | Mayotte of unit -type prise_en_compte_evaluation_montant = Complete of unit | Partagee of unit - -type versement_allocations = Normal of unit | AllocationVerseeAuxServicesSociaux of unit - -type age_alternatif = Absent of unit | Present of Runtime.integer - type element_prestations_familiales = | PrestationAccueilJeuneEnfant of unit | AllocationsFamiliales of unit @@ -49,44 +44,44 @@ type element_prestations_familiales = | AllocationRentreeScolaire of unit | AllocationJournalierePresenceParentale of unit -type personne = { numero_securite_sociale : Runtime.integer } - type enfant_entree = { - d_identifiant : Runtime.integer; - d_remuneration_mensuelle : Runtime.money; - d_date_de_naissance : Runtime.date; - d_garde_alternee : garde_alternee; - d_prise_en_charge_par_services_sociaux : prise_en_charge_service_sociaux; + d_identifiant : integer; + d_remuneration_mensuelle : money; + d_date_de_naissance : date; + d_prise_en_charge : prise_en_charge; + d_a_deja_ouvert_droit_aux_allocations_familiales : bool; } type enfant = { - identifiant : Runtime.integer; - fin_obligation_scolaire : Runtime.date; - remuneration_mensuelle : Runtime.money; - date_de_naissance : Runtime.date; - age : Runtime.integer; - garde_alternee : garde_alternee; - prise_en_charge_par_services_sociaux : prise_en_charge_service_sociaux; + identifiant : integer; + obligation_scolaire : situation_obligation_scolaire; + remuneration_mensuelle : money; + date_de_naissance : date; + age : integer; + prise_en_charge : prise_en_charge; + a_deja_ouvert_droit_aux_allocations_familiales : bool; } -type stockage_enfant = PasEnfant of unit | UnEnfant of enfant - type interface_allocations_familiales_out = { - date_courante_out : Runtime.date; + date_courante_out : date; enfants_out : enfant_entree array; enfants_a_charge_out : enfant array; - ressources_menage_out : Runtime.money; + ressources_menage_out : money; residence_out : collectivite; - montant_verse_out : Runtime.money; + montant_verse_out : money; + personne_charge_effective_permanente_est_parent_out : bool; + personne_charge_effective_permanente_remplit_titre_I_out : bool; } type interface_allocations_familiales_in = { - date_courante_in : unit -> Runtime.date; + date_courante_in : unit -> date; enfants_in : unit -> enfant_entree array; enfants_a_charge_in : unit -> enfant array; - ressources_menage_in : unit -> Runtime.money; + ressources_menage_in : unit -> money; residence_in : unit -> collectivite; - montant_verse_in : unit -> Runtime.money; + montant_verse_in : unit -> money; + personne_charge_effective_permanente_est_parent_in : unit -> bool; + personne_charge_effective_permanente_remplit_titre_I_in : unit -> bool; } val interface_allocations_familiales : diff --git a/src/french_law/law_source/unit_tests/dune b/src/french_law/law_source/unit_tests/dune index 2da498de..a0445e83 100644 --- a/src/french_law/law_source/unit_tests/dune +++ b/src/french_law/law_source/unit_tests/dune @@ -1,6 +1,4 @@ (executable (name run_tests) (modes native) - (package catala) - (public_name run_french_law_tests) (libraries catala ANSITerminal)) diff --git a/src/french_law/law_source/unit_tests/run_tests.ml b/src/french_law/law_source/unit_tests/run_tests.ml index b25c0f26..28aa04ed 100644 --- a/src/french_law/law_source/unit_tests/run_tests.ml +++ b/src/french_law/law_source/unit_tests/run_tests.ml @@ -19,4 +19,6 @@ let _ = try_test "Allocations familiales #4" Tests_allocations_familiales.test4; try_test "Allocations familiales #5" Tests_allocations_familiales.test5; try_test "Allocations familiales #6" Tests_allocations_familiales.test6; + try_test "Allocations familiales #7" Tests_allocations_familiales.test7; + try_test "Allocations familiales #8" Tests_allocations_familiales.test8; exit (if !failure then -1 else 0) diff --git a/tests/test_array/bad/output/fold_error.catala.A.out b/tests/test_array/bad/output/fold_error.catala.A.out index f247a1ae..3b731516 100644 --- a/tests/test_array/bad/output/fold_error.catala.A.out +++ b/tests/test_array/bad/output/fold_error.catala.A.out @@ -5,14 +5,14 @@ [ERROR] Error coming from typechecking the following expression: [ERROR] --> test_array/bad/fold_error.catala [ERROR] | -[ERROR] 10 | def list_high_count := number for m in list of (m >=$ $7) +[ERROR] 10 | def list_high_count := number for m in list of (m >=$ $7) [ERROR] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] + Article [ERROR] [ERROR] Type money coming from expression: [ERROR] --> test_array/bad/fold_error.catala [ERROR] | -[ERROR] 10 | def list_high_count := number for m in list of (m >=$ $7) +[ERROR] 10 | def list_high_count := number for m in list of (m >=$ $7) [ERROR] | ^^^ [ERROR] + Article [ERROR] diff --git a/tests/test_date/good/durations.catala b/tests/test_date/good/durations.catala index 21a83805..679314bd 100644 --- a/tests/test_date/good/durations.catala +++ b/tests/test_date/good/durations.catala @@ -9,8 +9,8 @@ new scope A: param z3 content duration scope A: - def x := |01/01/2019| - def y := |09/30/2002| + def x := |2019-01-01| + def y := |2002-09-30| def z := y +@ (x -@ y) = x def z3 := x -@ y def z2 := z3 = 5937 day diff --git a/tests/test_date/good/simple.catala b/tests/test_date/good/simple.catala index c7aa887a..724b23a7 100644 --- a/tests/test_date/good/simple.catala +++ b/tests/test_date/good/simple.catala @@ -7,7 +7,7 @@ new scope A: param z content duration scope A: - def x := |01/01/2019| - def y := |09/30/2002| + def x := |2019-01-01| + def y := |2002-09-30| def z := x -@ y ``` diff --git a/tests/test_enum/bad/output/missing_case.catala.A.out b/tests/test_enum/bad/output/missing_case.catala.A.out index 74426bc0..5e0a9079 100644 --- a/tests/test_enum/bad/output/missing_case.catala.A.out +++ b/tests/test_enum/bad/output/missing_case.catala.A.out @@ -1,7 +1,7 @@ [ERROR] The constructor Case3 of enum E is missing from this pattern matching -[ERROR] +[ERROR] [ERROR] --> test_enum/bad/missing_case.catala -[ERROR] | +[ERROR] | [ERROR] 14 | def out := match e with [ERROR] | ^^^^^^^^^^^ [ERROR] 15 | -- Case1 of i : i = 0 diff --git a/tests/test_enum/bad/output/quick_pattern_2.catala.A.out b/tests/test_enum/bad/output/quick_pattern_2.catala.A.out index 893e9eec..1695f5fb 100644 --- a/tests/test_enum/bad/output/quick_pattern_2.catala.A.out +++ b/tests/test_enum/bad/output/quick_pattern_2.catala.A.out @@ -1,6 +1,6 @@ [ERROR] Error during typechecking, incompatible types: -[ERROR] --> F [Case3: any[73]] -[ERROR] --> E [Case1: integer | Case2: unit] +[ERROR] --> F +[ERROR] --> E [ERROR] [ERROR] Error coming from typechecking the following expression: [ERROR] --> test_enum/bad/quick_pattern_2.catala @@ -9,14 +9,14 @@ [ERROR] | ^ [ERROR] + Article [ERROR] -[ERROR] Type F [Case3: any[73]] coming from expression: +[ERROR] Type F coming from expression: [ERROR] --> test_enum/bad/quick_pattern_2.catala [ERROR] | [ERROR] 28 | def y := x with Case3 [ERROR] | ^ [ERROR] + Article [ERROR] -[ERROR] Type E [Case1: integer | Case2: unit] coming from expression: +[ERROR] Type E coming from expression: [ERROR] --> test_enum/bad/quick_pattern_2.catala [ERROR] | [ERROR] 17 | param x content E diff --git a/tests/test_enum/bad/output/quick_pattern_3.catala.A.out b/tests/test_enum/bad/output/quick_pattern_3.catala.A.out index 57e53b55..3b69f516 100644 --- a/tests/test_enum/bad/output/quick_pattern_3.catala.A.out +++ b/tests/test_enum/bad/output/quick_pattern_3.catala.A.out @@ -1,6 +1,6 @@ [ERROR] Error during typechecking, incompatible types: -[ERROR] --> F [Case3: any[19] | Case4: any[20]] -[ERROR] --> E [Case1: unit | Case2: unit] +[ERROR] --> F +[ERROR] --> E [ERROR] [ERROR] Error coming from typechecking the following expression: [ERROR] --> test_enum/bad/quick_pattern_3.catala @@ -9,14 +9,14 @@ [ERROR] | ^ [ERROR] + Article [ERROR] -[ERROR] Type F [Case3: any[19] | Case4: any[20]] coming from expression: +[ERROR] Type F coming from expression: [ERROR] --> test_enum/bad/quick_pattern_3.catala [ERROR] | [ERROR] 18 | def y := x with Case3 [ERROR] | ^ [ERROR] + Article [ERROR] -[ERROR] Type E [Case1: unit | Case2: unit] coming from expression: +[ERROR] Type E coming from expression: [ERROR] --> test_enum/bad/quick_pattern_3.catala [ERROR] | [ERROR] 13 | param x content E diff --git a/tests/test_enum/bad/output/quick_pattern_4.catala.A.out b/tests/test_enum/bad/output/quick_pattern_4.catala.A.out index 5ede1a7c..b128a3b6 100644 --- a/tests/test_enum/bad/output/quick_pattern_4.catala.A.out +++ b/tests/test_enum/bad/output/quick_pattern_4.catala.A.out @@ -1,6 +1,6 @@ [ERROR] Error during typechecking, incompatible types: -[ERROR] --> F [Case3: any[19]] -[ERROR] --> E [Case1: unit | Case2: unit] +[ERROR] --> F +[ERROR] --> E [ERROR] [ERROR] Error coming from typechecking the following expression: [ERROR] --> test_enum/bad/quick_pattern_4.catala @@ -9,14 +9,14 @@ [ERROR] | ^ [ERROR] + Test [ERROR] -[ERROR] Type F [Case3: any[19]] coming from expression: +[ERROR] Type F coming from expression: [ERROR] --> test_enum/bad/quick_pattern_4.catala [ERROR] | [ERROR] 17 | def y := x with Case3 [ERROR] | ^ [ERROR] + Test [ERROR] -[ERROR] Type E [Case1: unit | Case2: unit] coming from expression: +[ERROR] Type E coming from expression: [ERROR] --> test_enum/bad/quick_pattern_4.catala [ERROR] | [ERROR] 12 | param x content E diff --git a/tests/test_exception/bad/output/ambiguous_unlabeled_exception.catala.A.out b/tests/test_exception/bad/output/ambiguous_unlabeled_exception.catala.A.out index 445853bd..3fef9f2d 100644 --- a/tests/test_exception/bad/output/ambiguous_unlabeled_exception.catala.A.out +++ b/tests/test_exception/bad/output/ambiguous_unlabeled_exception.catala.A.out @@ -1,11 +1,11 @@ [ERROR] This exception can refer to several definitions. Try using labels to disambiguate -[ERROR] +[ERROR] [ERROR] --> test_exception/bad/ambiguous_unlabeled_exception.catala -[ERROR] | +[ERROR] | [ERROR] 10 | def x := 1 -[ERROR] | -[ERROR] 11 | -[ERROR] | +[ERROR] | +[ERROR] 11 | +[ERROR] | [ERROR] 12 | exception [ERROR] | ^^^^^^^^^ [ERROR] 13 | def x := 2 diff --git a/tests/test_exception/bad/output/exceptions_cycle.catala.A.out b/tests/test_exception/bad/output/exceptions_cycle.catala.A.out index cd6b6891..3ba3a8ac 100644 --- a/tests/test_exception/bad/output/exceptions_cycle.catala.A.out +++ b/tests/test_exception/bad/output/exceptions_cycle.catala.A.out @@ -10,7 +10,7 @@ [ERROR] Used here in the definition of another cycle exception exception_x: [ERROR] --> test_exception/bad/exceptions_cycle.catala [ERROR] | -[ERROR] 17 | exception exception_x +[ERROR] 17 | exception exception_x [ERROR] | ^^^^^^^^^^^ [ERROR] + Test [ERROR] diff --git a/tests/test_exception/bad/output/missing_unlabeled_definition.catala.A.out b/tests/test_exception/bad/output/missing_unlabeled_definition.catala.A.out index 9851f11e..7a889e6a 100644 --- a/tests/test_exception/bad/output/missing_unlabeled_definition.catala.A.out +++ b/tests/test_exception/bad/output/missing_unlabeled_definition.catala.A.out @@ -1,9 +1,9 @@ [ERROR] This exception does not have a corresponding definition -[ERROR] +[ERROR] [ERROR] --> test_exception/bad/missing_unlabeled_definition.catala -[ERROR] | +[ERROR] | [ERROR] 7 | scope A: -[ERROR] | +[ERROR] | [ERROR] 8 | exception [ERROR] | ^^^^^^^^^ [ERROR] 9 | def x := 1 diff --git a/tests/test_money/bad/output/no_mingle.catala.A.out b/tests/test_money/bad/output/no_mingle.catala.A.out index a665814c..2c31580b 100644 --- a/tests/test_money/bad/output/no_mingle.catala.A.out +++ b/tests/test_money/bad/output/no_mingle.catala.A.out @@ -19,6 +19,6 @@ [ERROR] Type money coming from expression: [ERROR] --> test_money/bad/no_mingle.catala [ERROR] | -[ERROR] 6 | param y content money +[ERROR] 6 | param y content money [ERROR] | ^^^^^ [ERROR] + Article diff --git a/tests/test_scope/bad/output/cycle_in_scope.catala.A.out b/tests/test_scope/bad/output/cycle_in_scope.catala.A.out index 4f276d8c..bcd1fbdf 100644 --- a/tests/test_scope/bad/output/cycle_in_scope.catala.A.out +++ b/tests/test_scope/bad/output/cycle_in_scope.catala.A.out @@ -3,7 +3,7 @@ [ERROR] Cycle variable z, declared: [ERROR] --> test_scope/bad/cycle_in_scope.catala [ERROR] | -[ERROR] 7 | param z content int +[ERROR] 7 | param z content int [ERROR] | ^ [ERROR] + Article [ERROR] @@ -17,7 +17,7 @@ [ERROR] Cycle variable y, declared: [ERROR] --> test_scope/bad/cycle_in_scope.catala [ERROR] | -[ERROR] 6 | param y content int +[ERROR] 6 | param y content int [ERROR] | ^ [ERROR] + Article [ERROR] @@ -31,7 +31,7 @@ [ERROR] Cycle variable x, declared: [ERROR] --> test_scope/bad/cycle_in_scope.catala [ERROR] | -[ERROR] 5 | param x content int +[ERROR] 5 | param x content int [ERROR] | ^ [ERROR] + Article [ERROR] diff --git a/tests/test_scope/bad/output/sub_vars_in_sub_var.catala.A.out b/tests/test_scope/bad/output/sub_vars_in_sub_var.catala.A.out index 94fd63ac..bf22a563 100644 --- a/tests/test_scope/bad/output/sub_vars_in_sub_var.catala.A.out +++ b/tests/test_scope/bad/output/sub_vars_in_sub_var.catala.A.out @@ -2,6 +2,6 @@ [ERROR] [ERROR] --> test_scope/bad/sub_vars_in_sub_var.catala [ERROR] | -[ERROR] 13 | def a.y := if a.x then 0 else 1 +[ERROR] 13 | def a.y := if a.x then 0 else 1 [ERROR] | ^^^ [ERROR] + Article diff --git a/tests/test_struct/bad/output/ambiguous_fields.catala.A.out b/tests/test_struct/bad/output/ambiguous_fields.catala.A.out index 337a6a11..9dd4a1db 100644 --- a/tests/test_struct/bad/output/ambiguous_fields.catala.A.out +++ b/tests/test_struct/bad/output/ambiguous_fields.catala.A.out @@ -2,6 +2,6 @@ [ERROR] [ERROR] --> test_struct/bad/ambiguous_fields.catala [ERROR] | -[ERROR] 16 | def y := x.f +[ERROR] 16 | def y := x.f [ERROR] | ^ [ERROR] + Article diff --git a/tests/test_struct/bad/output/nested.catala.A.out b/tests/test_struct/bad/output/nested.catala.A.out index eef6b166..6c4062cf 100644 --- a/tests/test_struct/bad/output/nested.catala.A.out +++ b/tests/test_struct/bad/output/nested.catala.A.out @@ -2,6 +2,6 @@ [ERROR] [ERROR] --> test_struct/bad/nested.catala [ERROR] | -[ERROR] 5 | data x content S +[ERROR] 5 | data x content S [ERROR] | ^ [ERROR] + Article diff --git a/tests/test_struct/bad/output/nonexisting_struct.catala.A.out b/tests/test_struct/bad/output/nonexisting_struct.catala.A.out index 94882be8..7992818a 100644 --- a/tests/test_struct/bad/output/nonexisting_struct.catala.A.out +++ b/tests/test_struct/bad/output/nonexisting_struct.catala.A.out @@ -2,6 +2,6 @@ [ERROR] [ERROR] --> test_struct/bad/nonexisting_struct.catala [ERROR] | -[ERROR] 13 | def y := x.Fo.f +[ERROR] 13 | def y := x.Fo.f [ERROR] | ^^ [ERROR] + Article diff --git a/tests/test_struct/bad/output/wrong_qualified_field.catala.A.out b/tests/test_struct/bad/output/wrong_qualified_field.catala.A.out index cc6949b3..284da9ed 100644 --- a/tests/test_struct/bad/output/wrong_qualified_field.catala.A.out +++ b/tests/test_struct/bad/output/wrong_qualified_field.catala.A.out @@ -2,6 +2,6 @@ [ERROR] [ERROR] --> test_struct/bad/wrong_qualified_field.catala [ERROR] | -[ERROR] 17 | def y := x.Foo.g +[ERROR] 17 | def y := x.Foo.g [ERROR] | ^^^^^^^ [ERROR] + Article