{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NoFieldSelectors #-} {-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module Tax.Canada.Federal.Schedule6 where import Data.Fixed (Centi) import Data.Text (Text) import Language.Haskell.TH qualified as TH import Rank2 qualified import Rank2.TH qualified import Transformation.Shallow.TH qualified import Tax.Canada.Shared (SubCalculation(SubCalculation, calculation, result), fixSubCalculation, subCalculationFields) import Tax.Canada.T1.Types (T1) import Tax.Canada.T1.Types qualified as T1 import Tax.FDF (Entry (Amount, Constant, Percent, Switch'), FieldConst (Field), within) import Tax.Util (fixEq, fractionOf, difference, nonNegativeDifference, totalOf) data Schedule6 line = Schedule6{ forall (line :: * -> *). Schedule6 line -> Page2 line page2 :: Page2 line, forall (line :: * -> *). Schedule6 line -> Page3 line page3 :: Page3 line, forall (line :: * -> *). Schedule6 line -> Page4 line page4 :: Page4 line} data Page2 line = Page2{ forall (line :: * -> *). Page2 line -> Questions line questions :: Questions line, forall (line :: * -> *). Page2 line -> PartAColumn line partA_self :: PartAColumn line, forall (line :: * -> *). Page2 line -> PartAColumn line partA_spouse :: PartAColumn line, forall (line :: * -> *). Page2 line -> line Centi line6_sum :: line Centi} data Questions line = Questions{ forall (line :: * -> *). Questions line -> line Bool line_38100 :: line Bool, forall (line :: * -> *). Questions line -> line Bool line_38101 :: line Bool, forall (line :: * -> *). Questions line -> line Bool line_38102 :: line Bool, forall (line :: * -> *). Questions line -> line Bool line_38103 :: line Bool, forall (line :: * -> *). Questions line -> line Bool line_38104 :: line Bool, forall (line :: * -> *). Questions line -> line Bool line_38105 :: line Bool} data PartAColumn line = PartAColumn{ forall (line :: * -> *). PartAColumn line -> line Centi line1_employmentIncome_copy :: line Centi, forall (line :: * -> *). PartAColumn line -> line Centi line_38106_grants_copy :: line Centi, forall (line :: * -> *). PartAColumn line -> line Centi line3_selfEmploymentIncome_sum :: line Centi, forall (line :: * -> *). PartAColumn line -> line Centi line_38107_exemptIncome :: line Centi, forall (line :: * -> *). PartAColumn line -> line Centi line_38108_sum :: line Centi} data Page3 line = Page3{ forall (line :: * -> *). Page3 line -> PartBColumn line partB_self :: PartBColumn line, forall (line :: * -> *). Page3 line -> PartBColumn line partB_spouse :: PartBColumn line, forall (line :: * -> *). Page3 line -> line Centi line13_sum :: line Centi, forall (line :: * -> *). Page3 line -> line Centi line14_least :: line Centi, forall (line :: * -> *). Page3 line -> line Centi line15_difference :: line Centi} data PartBColumn line = PartBColumn{ forall (line :: * -> *). PartBColumn line -> line Centi line7_netIncome_copy :: line Centi, forall (line :: * -> *). PartBColumn line -> line Centi line_38109_exempt :: line Centi, forall (line :: * -> *). PartBColumn line -> line Centi line9_uccbRdspRepayments :: line Centi, forall (line :: * -> *). PartBColumn line -> line Centi line10_sum :: line Centi, forall (line :: * -> *). PartBColumn line -> line Centi line11_uccbRdspIncome :: line Centi, forall (line :: * -> *). PartBColumn line -> line Centi line_38110_difference :: line Centi} data Page4 line = Page4{ forall (line :: * -> *). Page4 line -> Step2 line step2 :: Step2 line, forall (line :: * -> *). Page4 line -> Step3 line step3 :: Step3 line} data Step2 line = Step2{ forall (line :: * -> *). Step2 line -> line Centi line16_copy :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line17_threshold :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line18_difference :: line Centi, forall (line :: * -> *). Step2 line -> line Rational line19_rate :: line Rational, forall (line :: * -> *). Step2 line -> line Centi line20_fraction :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line21_ceiling :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line22_least :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line23_copy :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line24_threshold :: line Centi, forall (line :: * -> *). Step2 line -> line Centi line25_difference :: line Centi, forall (line :: * -> *). Step2 line -> line Rational line26_rate :: line Rational, forall (line :: * -> *). Step2 line -> SubCalculation line line27_fraction :: SubCalculation line, forall (line :: * -> *). Step2 line -> line Centi line28_difference :: line Centi} data Step3 line = Step3{ forall (line :: * -> *). Step3 line -> line Centi line29_copy :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line30_threshold :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line31_difference :: line Centi, forall (line :: * -> *). Step3 line -> line Rational line32_rate :: line Rational, forall (line :: * -> *). Step3 line -> line Centi line33_fraction :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line34_capped :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line35_copy :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line36_threshold :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line37_difference :: line Centi, forall (line :: * -> *). Step3 line -> line Rational line38_rate :: line Rational, forall (line :: * -> *). Step3 line -> SubCalculation line line39_fraction :: SubCalculation line, forall (line :: * -> *). Step3 line -> line Centi line40_difference :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line41_copy :: line Centi, forall (line :: * -> *). Step3 line -> line Centi line42_sum :: line Centi} $