{-# 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.Schedule7 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, result), fixSubCalculation, subCalculationFields) import Tax.Canada.T1.Types (T1) import Tax.Canada.T1.Types qualified as T1 import Tax.FDF (Entry (Amount, Checkbox), FieldConst (Field), within) import Tax.Util (fixEq, fractionOf, difference, nonNegativeDifference, totalOf) data Schedule7 line = Schedule7{ forall (line :: * -> *). Schedule7 line -> Page2 line page2 :: Page2 line, forall (line :: * -> *). Schedule7 line -> Page3 line page3 :: Page3 line, forall (line :: * -> *). Schedule7 line -> Page4 line page4 :: Page4 line} data Page2 line = Page2{ forall (line :: * -> *). Page2 line -> line Centi line1_pastUnused :: line Centi, forall (line :: * -> *). Page2 line -> line Centi line2_pastYearContributions :: line Centi, forall (line :: * -> *). Page2 line -> line Centi line3_thisYearContributions :: line Centi, forall (line :: * -> *). Page2 line -> SubCalculation line line_24500_contributions_sum :: SubCalculation line, forall (line :: * -> *). Page2 line -> line Centi line5_sum :: line Centi} data Page3 line = Page3{ forall (line :: * -> *). Page3 line -> PartB line partB :: PartB line, forall (line :: * -> *). Page3 line -> PartC line partC :: PartC line} data PartB line = PartB{ forall (line :: * -> *). PartB line -> line Centi line6_contributions_copy :: line Centi, forall (line :: * -> *). PartB line -> line Centi line_24600_hbp :: line Centi, forall (line :: * -> *). PartB line -> line Centi line_24620_llp :: line Centi, forall (line :: * -> *). PartB line -> SubCalculation line line9_repayments_sum :: SubCalculation line, forall (line :: * -> *). PartB line -> line Centi line10_difference :: line Centi} data PartC line = PartC{ forall (line :: * -> *). PartC line -> line Centi line11_deductionLimit :: line Centi, forall (line :: * -> *). PartC line -> line Centi line12_prpp_copy :: line Centi, forall (line :: * -> *). PartC line -> line Centi line13_difference :: line Centi, forall (line :: * -> *). PartC line -> line Centi line14_copy :: line Centi, forall (line :: * -> *). PartC line -> line Centi line_24640_transfers :: line Centi, forall (line :: * -> *). PartC line -> line Centi line15_cont :: line Centi, forall (line :: * -> *). PartC line -> line Centi line16_difference :: line Centi, forall (line :: * -> *). PartC line -> line Centi line17_lesser :: line Centi, forall (line :: * -> *). PartC line -> line Centi line18_deducting :: line Centi, forall (line :: * -> *). PartC line -> line Centi line19_sum :: line Centi, forall (line :: * -> *). PartC line -> line Centi line20_deduction :: line Centi} data Page4 line = Page4{ forall (line :: * -> *). Page4 line -> PartD line partD :: PartD line, forall (line :: * -> *). Page4 line -> PartE line partE :: PartE line, forall (line :: * -> *). Page4 line -> line Centi line_26700_athleteTrust :: line Centi} data PartD line = PartD{ forall (line :: * -> *). PartD line -> line Centi line21_copy :: line Centi, forall (line :: * -> *). PartD line -> line Centi line22_copy :: line Centi, forall (line :: * -> *). PartD line -> line Centi line23_difference :: line Centi} data PartE line = PartE{ forall (line :: * -> *). PartE line -> line Centi line_24700_hbp :: line Centi, forall (line :: * -> *). PartE line -> line Bool line_25900_hbpSame :: line Bool, forall (line :: * -> *). PartE line -> line Centi line_26300_llp :: line Centi, forall (line :: * -> *). PartE line -> line Bool line_26400_llpSpouse :: line Bool} $