{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Data.Tax.ATO
(
TaxReturnInfo
, newTaxReturnInfo
, newTaxReturnInfoForTables
, income
, PaymentSummary(..)
, paymentSummaries
, ABN
, interest
, Dividend(..)
, dividends
, dividendFrankingCredit
, HasCapitalLossCarryForward(..)
, cgtEvents
, ESSStatement
, newESSStatement
, ess
, essTaxedUpfrontReduction
, essTaxedUpfrontNoReduction
, essDeferral
, essPre2009
, essTFNAmounts
, essForeignSourceDiscounts
, foreignIncome
, mlsExemption
, privateHealthInsurancePolicyDetails
, helpBalance
, sfssBalance
, SpouseDetails
, spouseDetails
, newSpouseDetails
, spouseTaxableIncome
, IncomeTests
, incomeTests
, newIncomeTests
, taxFreeGovernmentPensionsOrBenefits
, targetForeignIncome
, childSupportPaid
, dependentChildren
, Deductions
, deductions
, totalDeductions
, workRelatedCarExpenses
, workRelatedTravelExpenses
, workRelatedClothingLaundryAndDryCleaningExpenses
, workRelatedSelfEducationExpenses
, otherWorkRelatedExpenses
, lowValuePoolDeduction
, interestDeductions
, dividendDeductions
, giftsOrDonations
, costOfManagingTaxAffairs
, deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity
, personalSuperannuationContributions
, deductionForProjectPool
, forestryManagedInvestmentSchemeDeduction
, otherDeductions
, foreignIncomeDeductions
, Offsets
, offsets
, spouseContributionOffset
, foreignTaxOffset
, paygInstalments
, TaxAssessment
, assessTax
, taxBalance
, taxDue
, medicareLevyDue
, taxCreditsAndOffsets
, taxCGTAssessment
, privateHealthInsuranceRebateAdjustment
, corporateTax
, GrossAndWithheld(..)
, HasTaxWithheld(..)
, Proportion
, getProportion
, proportion
, module Data.Tax
, module Data.Tax.ATO.PrivateHealthInsuranceRebate
, module Data.Tax.ATO.Rounding
) where
import Control.Lens (Getter, Lens', (&), foldOf, lens, set, to, view, views)
import Data.Tax
import Data.Tax.ATO.CGT
import Data.Tax.ATO.Common
import Data.Tax.ATO.Days
import Data.Tax.ATO.PrivateHealthInsuranceRebate
import Data.Tax.ATO.Rounding
class HasTaxWithheld a b c where
taxWithheld :: Getter (a b) (Money c)
instance (Foldable t, HasTaxWithheld x a a, Num a)
=> HasTaxWithheld t (x a) a where
taxWithheld :: Getter (t (x a)) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld))
newtype SpouseDetails a = SpouseDetails
{ forall a. SpouseDetails a -> Money a
_spouseTaxableIncome :: Money a
}
newSpouseDetails :: (Num a) => SpouseDetails a
newSpouseDetails :: forall a. Num a => SpouseDetails a
newSpouseDetails = forall a. Money a -> SpouseDetails a
SpouseDetails forall a. Monoid a => a
mempty
spouseTaxableIncome :: Lens' (SpouseDetails a) (Money a)
spouseTaxableIncome :: forall a. Lens' (SpouseDetails a) (Money a)
spouseTaxableIncome =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. SpouseDetails a -> Money a
_spouseTaxableIncome (\SpouseDetails a
s Money a
b -> SpouseDetails a
s { _spouseTaxableIncome :: Money a
_spouseTaxableIncome = Money a
b })
data IncomeTests a = IncomeTests
{ forall a. IncomeTests a -> Money a
_govBenefit :: Money a
, forall a. IncomeTests a -> Money a
_targetForeignIncome :: Money a
, forall a. IncomeTests a -> Money a
_childSupportPaid :: Money a
, forall a. IncomeTests a -> Integer
_dependents :: Integer
}
newIncomeTests :: (Num a) => IncomeTests a
newIncomeTests :: forall a. Num a => IncomeTests a
newIncomeTests = forall a. Money a -> Money a -> Money a -> Integer -> IncomeTests a
IncomeTests forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty Integer
0
taxFreeGovernmentPensionsOrBenefits :: Lens' (IncomeTests a) (Money a)
taxFreeGovernmentPensionsOrBenefits :: forall a. Lens' (IncomeTests a) (Money a)
taxFreeGovernmentPensionsOrBenefits =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. IncomeTests a -> Money a
_govBenefit (\IncomeTests a
s Money a
b -> IncomeTests a
s { _govBenefit :: Money a
_govBenefit = Money a
b })
targetForeignIncome :: Lens' (IncomeTests a) (Money a)
targetForeignIncome :: forall a. Lens' (IncomeTests a) (Money a)
targetForeignIncome =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. IncomeTests a -> Money a
_targetForeignIncome (\IncomeTests a
s Money a
b -> IncomeTests a
s { _targetForeignIncome :: Money a
_targetForeignIncome = Money a
b })
childSupportPaid :: Lens' (IncomeTests a) (Money a)
childSupportPaid :: forall a. Lens' (IncomeTests a) (Money a)
childSupportPaid =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. IncomeTests a -> Money a
_childSupportPaid (\IncomeTests a
s Money a
b -> IncomeTests a
s { _childSupportPaid :: Money a
_childSupportPaid = Money a
b })
dependentChildren :: Lens' (IncomeTests a) Integer
dependentChildren :: forall a. Lens' (IncomeTests a) Integer
dependentChildren =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. IncomeTests a -> Integer
_dependents (\IncomeTests a
s Integer
b -> IncomeTests a
s { _dependents :: Integer
_dependents = Integer
b })
data TaxReturnInfo y a = TaxReturnInfo
{ forall (y :: Year) a. TaxReturnInfo y a -> Days y
_mlsExemption :: Days y
, forall (y :: Year) a. TaxReturnInfo y a -> Money a
_helpBalance :: Money a
, forall (y :: Year) a. TaxReturnInfo y a -> Money a
_sfssBalance :: Money a
, forall (y :: Year) a. TaxReturnInfo y a -> [PaymentSummary a]
_paymentSummaries :: [PaymentSummary a]
, forall (y :: Year) a. TaxReturnInfo y a -> GrossAndWithheld a
_interest :: GrossAndWithheld a
, forall (y :: Year) a. TaxReturnInfo y a -> [Dividend a]
_dividends :: [Dividend a]
, forall (y :: Year) a. TaxReturnInfo y a -> ESSStatement a
_ess :: ESSStatement a
, forall (y :: Year) a. TaxReturnInfo y a -> Money a
_foreignIncome :: Money a
, forall (y :: Year) a. TaxReturnInfo y a -> [CGTEvent a]
_cgtEvents :: [CGTEvent a]
, forall (y :: Year) a. TaxReturnInfo y a -> Deductions a
_deductions :: Deductions a
, forall (y :: Year) a. TaxReturnInfo y a -> Offsets a
_offsets :: Offsets a
, forall (y :: Year) a. TaxReturnInfo y a -> Money a
_triCapitalLossCarryForward :: Money a
, forall (y :: Year) a.
TaxReturnInfo y a -> [PrivateHealthInsurancePolicyDetail a]
_phi :: [PrivateHealthInsurancePolicyDetail a]
, forall (y :: Year) a. TaxReturnInfo y a -> Maybe (SpouseDetails a)
_spouseDetails :: Maybe (SpouseDetails a)
, forall (y :: Year) a. TaxReturnInfo y a -> IncomeTests a
_incomeTests :: IncomeTests a
}
newTaxReturnInfo
:: (DaysInYear y, Num a)
=> TaxReturnInfo y a
newTaxReturnInfo :: forall (y :: Year) a. (DaysInYear y, Num a) => TaxReturnInfo y a
newTaxReturnInfo = forall (y :: Year) a.
Days y
-> Money a
-> Money a
-> [PaymentSummary a]
-> GrossAndWithheld a
-> [Dividend a]
-> ESSStatement a
-> Money a
-> [CGTEvent a]
-> Deductions a
-> Offsets a
-> Money a
-> [PrivateHealthInsurancePolicyDetail a]
-> Maybe (SpouseDetails a)
-> IncomeTests a
-> TaxReturnInfo y a
TaxReturnInfo
forall (a :: Year). DaysInYear a => Days a
daysAll
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Maybe a
Nothing
forall a. Num a => IncomeTests a
newIncomeTests
newTaxReturnInfoForTables
:: (DaysInYear y, Num a)
=> TaxTables y a -> TaxReturnInfo y a
newTaxReturnInfoForTables :: forall (y :: Year) a.
(DaysInYear y, Num a) =>
TaxTables y a -> TaxReturnInfo y a
newTaxReturnInfoForTables TaxTables y a
_ = forall (y :: Year) a. (DaysInYear y, Num a) => TaxReturnInfo y a
newTaxReturnInfo
instance HasCapitalLossCarryForward (TaxReturnInfo y) a where
capitalLossCarryForward :: Lens' (TaxReturnInfo y a) (Money a)
capitalLossCarryForward = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Money a
_triCapitalLossCarryForward
(\TaxReturnInfo y a
s Money a
b -> TaxReturnInfo y a
s { _triCapitalLossCarryForward :: Money a
_triCapitalLossCarryForward = Money a
b })
helpBalance :: Lens' (TaxReturnInfo y a) (Money a)
helpBalance :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
helpBalance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Money a
_helpBalance (\TaxReturnInfo y a
s Money a
b -> TaxReturnInfo y a
s { _helpBalance :: Money a
_helpBalance = Money a
b })
sfssBalance :: Lens' (TaxReturnInfo y a) (Money a)
sfssBalance :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
sfssBalance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Money a
_sfssBalance (\TaxReturnInfo y a
s Money a
b -> TaxReturnInfo y a
s { _sfssBalance :: Money a
_sfssBalance = Money a
b })
mlsExemption :: Lens' (TaxReturnInfo y a) (Days y)
mlsExemption :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Days y)
mlsExemption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Days y
_mlsExemption (\TaxReturnInfo y a
s Days y
b -> TaxReturnInfo y a
s { _mlsExemption :: Days y
_mlsExemption = Days y
b })
paymentSummaries :: Lens' (TaxReturnInfo y a) [PaymentSummary a]
paymentSummaries :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) [PaymentSummary a]
paymentSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> [PaymentSummary a]
_paymentSummaries (\TaxReturnInfo y a
s [PaymentSummary a]
b -> TaxReturnInfo y a
s { _paymentSummaries :: [PaymentSummary a]
_paymentSummaries = [PaymentSummary a]
b })
interest :: Lens' (TaxReturnInfo y a) (GrossAndWithheld a)
interest :: forall (y :: Year) a.
Lens' (TaxReturnInfo y a) (GrossAndWithheld a)
interest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> GrossAndWithheld a
_interest (\TaxReturnInfo y a
s GrossAndWithheld a
b -> TaxReturnInfo y a
s { _interest :: GrossAndWithheld a
_interest = GrossAndWithheld a
b })
dividends :: Lens' (TaxReturnInfo y a) [Dividend a]
dividends :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) [Dividend a]
dividends = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> [Dividend a]
_dividends (\TaxReturnInfo y a
s [Dividend a]
b -> TaxReturnInfo y a
s { _dividends :: [Dividend a]
_dividends = [Dividend a]
b })
ess :: Lens' (TaxReturnInfo y a) (ESSStatement a)
ess :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (ESSStatement a)
ess = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> ESSStatement a
_ess (\TaxReturnInfo y a
s ESSStatement a
b -> TaxReturnInfo y a
s { _ess :: ESSStatement a
_ess = ESSStatement a
b })
foreignIncome :: Lens' (TaxReturnInfo y a) (Money a)
foreignIncome :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
foreignIncome = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Money a
_foreignIncome (\TaxReturnInfo y a
s Money a
b -> TaxReturnInfo y a
s { _foreignIncome :: Money a
_foreignIncome = Money a
b })
cgtEvents :: Lens' (TaxReturnInfo y a) [CGTEvent a]
cgtEvents :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) [CGTEvent a]
cgtEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> [CGTEvent a]
_cgtEvents (\TaxReturnInfo y a
s [CGTEvent a]
b -> TaxReturnInfo y a
s { _cgtEvents :: [CGTEvent a]
_cgtEvents = [CGTEvent a]
b })
deductions :: Lens' (TaxReturnInfo y a) (Deductions a)
deductions :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Deductions a)
deductions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Deductions a
_deductions (\TaxReturnInfo y a
s Deductions a
b -> TaxReturnInfo y a
s { _deductions :: Deductions a
_deductions = Deductions a
b })
offsets :: Lens' (TaxReturnInfo y a) (Offsets a)
offsets :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Offsets a)
offsets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Offsets a
_offsets (\TaxReturnInfo y a
s Offsets a
b -> TaxReturnInfo y a
s { _offsets :: Offsets a
_offsets = Offsets a
b })
privateHealthInsurancePolicyDetails
:: Lens' (TaxReturnInfo y a) [PrivateHealthInsurancePolicyDetail a]
privateHealthInsurancePolicyDetails :: forall (y :: Year) a.
Lens' (TaxReturnInfo y a) [PrivateHealthInsurancePolicyDetail a]
privateHealthInsurancePolicyDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a.
TaxReturnInfo y a -> [PrivateHealthInsurancePolicyDetail a]
_phi (\TaxReturnInfo y a
s [PrivateHealthInsurancePolicyDetail a]
b -> TaxReturnInfo y a
s { _phi :: [PrivateHealthInsurancePolicyDetail a]
_phi = [PrivateHealthInsurancePolicyDetail a]
b })
spouseDetails :: Lens' (TaxReturnInfo y a) (Maybe (SpouseDetails a))
spouseDetails :: forall (y :: Year) a.
Lens' (TaxReturnInfo y a) (Maybe (SpouseDetails a))
spouseDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> Maybe (SpouseDetails a)
_spouseDetails (\TaxReturnInfo y a
s Maybe (SpouseDetails a)
b -> TaxReturnInfo y a
s { _spouseDetails :: Maybe (SpouseDetails a)
_spouseDetails = Maybe (SpouseDetails a)
b })
incomeTests :: Lens' (TaxReturnInfo y a) (IncomeTests a)
incomeTests :: forall (y :: Year) a. Lens' (TaxReturnInfo y a) (IncomeTests a)
incomeTests = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (y :: Year) a. TaxReturnInfo y a -> IncomeTests a
_incomeTests (\TaxReturnInfo y a
s IncomeTests a
b -> TaxReturnInfo y a
s { _incomeTests :: IncomeTests a
_incomeTests = IncomeTests a
b })
data TaxAssessment a = TaxAssessment
{ forall a. TaxAssessment a -> Money a
_taxableIncome :: Money a
, forall a. TaxAssessment a -> Money a
_taxDue :: Money a
, forall a. TaxAssessment a -> Money a
_medicareLevyDue :: Money a
, forall a. TaxAssessment a -> Money a
_taxWithheld :: Money a
, forall a. TaxAssessment a -> Money a
_taxCreditsAndOffsets :: Money a
, forall a. TaxAssessment a -> CGTAssessment a
_taCGTAssessment :: CGTAssessment a
, forall a. TaxAssessment a -> Money a
_phiAdj :: Money a
}
instance HasIncome TaxAssessment a a where
income :: Getter (TaxAssessment a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. TaxAssessment a -> Money a
_taxableIncome
instance HasTaxWithheld TaxAssessment a a where
taxWithheld :: Getter (TaxAssessment a) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. TaxAssessment a -> Money a
_taxWithheld
taxDue :: Getter (TaxAssessment a) (Money a)
taxDue :: forall a. Getter (TaxAssessment a) (Money a)
taxDue = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. TaxAssessment a -> Money a
_taxDue
medicareLevyDue :: Getter (TaxAssessment a) (Money a)
medicareLevyDue :: forall a. Getter (TaxAssessment a) (Money a)
medicareLevyDue = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. TaxAssessment a -> Money a
_medicareLevyDue
taxCreditsAndOffsets :: Getter (TaxAssessment a) (Money a)
taxCreditsAndOffsets :: forall a. Getter (TaxAssessment a) (Money a)
taxCreditsAndOffsets = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. TaxAssessment a -> Money a
_taxCreditsAndOffsets
taxCGTAssessment :: Lens' (TaxAssessment a) (CGTAssessment a)
taxCGTAssessment :: forall a. Lens' (TaxAssessment a) (CGTAssessment a)
taxCGTAssessment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. TaxAssessment a -> CGTAssessment a
_taCGTAssessment (\TaxAssessment a
s CGTAssessment a
b -> TaxAssessment a
s { _taCGTAssessment :: CGTAssessment a
_taCGTAssessment = CGTAssessment a
b })
privateHealthInsuranceRebateAdjustment :: Lens' (TaxAssessment a) (Money a)
privateHealthInsuranceRebateAdjustment :: forall a. Lens' (TaxAssessment a) (Money a)
privateHealthInsuranceRebateAdjustment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. TaxAssessment a -> Money a
_phiAdj (\TaxAssessment a
s Money a
b -> TaxAssessment a
s { _phiAdj :: Money a
_phiAdj = Money a
b })
taxBalance :: Num a => Getter (TaxAssessment a) (Money a)
taxBalance :: forall a. Num a => Getter (TaxAssessment a) (Money a)
taxBalance = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \TaxAssessment a
a ->
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld TaxAssessment a
a
forall a. Num a => Money a -> Money a -> Money a
$-$ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Getter (TaxAssessment a) (Money a)
taxDue TaxAssessment a
a
forall a. Num a => Money a -> Money a -> Money a
$-$ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Getter (TaxAssessment a) (Money a)
medicareLevyDue TaxAssessment a
a
forall a. Num a => Money a -> Money a -> Money a
$-$ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (TaxAssessment a) (Money a)
privateHealthInsuranceRebateAdjustment TaxAssessment a
a
forall a. Num a => Money a -> Money a -> Money a
$+$ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Getter (TaxAssessment a) (Money a)
taxCreditsAndOffsets TaxAssessment a
a
instance (Num a, Eq a) => HasCapitalLossCarryForward TaxAssessment a where
capitalLossCarryForward :: Lens' (TaxAssessment a) (Money a)
capitalLossCarryForward = forall a. Lens' (TaxAssessment a) (CGTAssessment a)
taxCGTAssessment forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: * -> *) b.
HasCapitalLossCarryForward a b =>
Lens' (a b) (Money b)
capitalLossCarryForward
individualTax
:: (Fractional a, Ord a)
=> TaxTables y a
-> Tax (Money a) (Money a)
individualTax :: forall {k} a (y :: k).
(Fractional a, Ord a) =>
TaxTables y a -> Tax (Money a) (Money a)
individualTax TaxTables y a
table =
forall a b. Ord a => Tax b a -> Tax b a -> Tax b a
greaterOf forall a. Monoid a => a
mempty (forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttIndividualIncomeTax TaxTables y a
table forall a. Semigroup a => a -> a -> a
<> forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttAdditional TaxTables y a
table)
studyAndTrainingLoanRepayment
:: (Fractional a, Ord a)
=> TaxTables y a
-> TaxReturnInfo y a
-> Tax (Money a) (Money a)
studyAndTrainingLoanRepayment :: forall a (y :: Year).
(Fractional a, Ord a) =>
TaxTables y a -> TaxReturnInfo y a -> Tax (Money a) (Money a)
studyAndTrainingLoanRepayment TaxTables y a
table TaxReturnInfo y a
info =
forall a b. Ord a => a -> Tax b a -> Tax b a
limit (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
helpBalance TaxReturnInfo y a
info) (forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttHelp TaxTables y a
table)
forall a. Semigroup a => a -> a -> a
<> forall a b. Ord a => a -> Tax b a -> Tax b a
limit (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
sfssBalance TaxReturnInfo y a
info) (forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttSfss TaxTables y a
table)
medicareLevyTax
:: (DaysInYear y, Fractional a)
=> TaxTables y a
-> TaxReturnInfo y a
-> Tax (Money a) (Money a)
medicareLevyTax :: forall (y :: Year) a.
(DaysInYear y, Fractional a) =>
TaxTables y a -> TaxReturnInfo y a -> Tax (Money a) (Money a)
medicareLevyTax TaxTables y a
table TaxReturnInfo y a
info =
let
ml :: Tax (Money a) (Money a)
ml = forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttMedicareLevy TaxTables y a
table
mls :: Tax (Money a) (Money a)
mls = forall {k} (y :: k) a. TaxTables y a -> Tax (Money a) (Money a)
ttMedicareLevySurcharge TaxTables y a
table
mlsFrac :: a
mlsFrac = a
1 forall a. Num a => a -> a -> a
- forall (a :: Year) frac.
(DaysInYear a, Fractional frac) =>
Days a -> frac
getFraction (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Days y)
mlsExemption TaxReturnInfo y a
info)
in
Tax (Money a) (Money a)
ml
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a. Num a => Money a -> a -> Money a
$* a
mlsFrac) Tax (Money a) (Money a)
mls
instance (RealFrac a) => HasIncome (TaxReturnInfo y) a a where
income :: Getter (TaxReturnInfo y a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \TaxReturnInfo y a
info ->
let
cf :: Money a
cf = forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (a :: * -> *) b.
HasCapitalLossCarryForward a b =>
Lens' (a b) (Money b)
capitalLossCarryForward TaxReturnInfo y a
info
gross :: Money a
gross = forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap forall a. RealFrac a => Money a -> Money a
wholeDollars
[ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) [PaymentSummary a]
paymentSummaries forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income) TaxReturnInfo y a
info
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a.
Lens' (TaxReturnInfo y a) (GrossAndWithheld a)
interest forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income) TaxReturnInfo y a
info
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) [Dividend a]
dividends forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income) TaxReturnInfo y a
info
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (ESSStatement a)
ess forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income) TaxReturnInfo y a
info
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) [CGTEvent a]
cgtEvents forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (forall a (t :: * -> *).
(Fractional a, Ord a, Foldable t) =>
Money a -> t (CGTEvent a) -> CGTAssessment a
assessCGTEvents Money a
cf) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Getter (CGTAssessment a) (Money a)
cgtNetGain) TaxReturnInfo y a
info
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
foreignIncome TaxReturnInfo y a
info
]
in
forall a. RealFrac a => Money a -> Money a
wholeDollars (Money a
gross forall a. Num a => Money a -> Money a -> Money a
$-$ forall s (m :: * -> *) r a.
MonadReader s m =>
LensLike' (Const r) s a -> (a -> r) -> m r
views forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Deductions a)
deductions forall a. (Num a, Ord a) => Deductions a -> Money a
totalDeductions TaxReturnInfo y a
info)
instance (Num a) => HasTaxWithheld (TaxReturnInfo y) a a where
taxWithheld :: Getter (TaxReturnInfo y a) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \TaxReturnInfo y a
info ->
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) [PaymentSummary a]
paymentSummaries forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld) TaxReturnInfo y a
info
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a.
Lens' (TaxReturnInfo y a) (GrossAndWithheld a)
interest forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld) TaxReturnInfo y a
info
assessTax
:: (DaysInYear y, RealFrac a)
=> TaxTables y a -> TaxReturnInfo y a -> TaxAssessment a
assessTax :: forall (y :: Year) a.
(DaysInYear y, RealFrac a) =>
TaxTables y a -> TaxReturnInfo y a -> TaxAssessment a
assessTax TaxTables y a
tables TaxReturnInfo y a
info =
let
cg :: CGTAssessment a
cg = forall a (t :: * -> *).
(Fractional a, Ord a, Foldable t) =>
Money a -> t (CGTEvent a) -> CGTAssessment a
assessCGTEvents
(forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (a :: * -> *) b.
HasCapitalLossCarryForward a b =>
Lens' (a b) (Money b)
capitalLossCarryForward TaxReturnInfo y a
info) (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) [CGTEvent a]
cgtEvents TaxReturnInfo y a
info)
taxable :: Money a
taxable = forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income TaxReturnInfo y a
info
due :: Money a
due = forall a b. Tax a b -> a -> b
getTax (forall {k} a (y :: k).
(Fractional a, Ord a) =>
TaxTables y a -> Tax (Money a) (Money a)
individualTax TaxTables y a
tables) Money a
taxable
studyRepayment :: Money a
studyRepayment = forall a b. Tax a b -> a -> b
getTax (forall a (y :: Year).
(Fractional a, Ord a) =>
TaxTables y a -> TaxReturnInfo y a -> Tax (Money a) (Money a)
studyAndTrainingLoanRepayment TaxTables y a
tables TaxReturnInfo y a
info) Money a
taxable
mlAndMLS :: Money a
mlAndMLS = forall a b. Tax a b -> a -> b
getTax (forall (y :: Year) a.
(DaysInYear y, Fractional a) =>
TaxTables y a -> TaxReturnInfo y a -> Tax (Money a) (Money a)
medicareLevyTax TaxTables y a
tables TaxReturnInfo y a
info) Money a
taxable
incomeForSurchargePurposes :: Money a
incomeForSurchargePurposes =
Money a
taxable
forall a. Semigroup a => a -> a -> a
<> forall a s. Getting a s a -> s -> a
foldOf (forall (y :: Year) a. Lens' (TaxReturnInfo y a) [PaymentSummary a]
paymentSummaries forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. PaymentSummary a -> Money a
reportableEmployerSuperannuationContributions) TaxReturnInfo y a
info
spouseIncomeForSurchargePurposes :: Maybe (Money a)
spouseIncomeForSurchargePurposes =
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (SpouseDetails a) (Money a)
spouseTaxableIncome) (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a.
Lens' (TaxReturnInfo y a) (Maybe (SpouseDetails a))
spouseDetails TaxReturnInfo y a
info)
phiAdj :: Money a
phiAdj = forall a.
RealFrac a =>
Money a
-> Maybe (Money a)
-> Integer
-> PrivateHealthInsuranceRebateRates a
-> [PrivateHealthInsurancePolicyDetail a]
-> Money a
assessExcessPrivateHealthRebate
Money a
incomeForSurchargePurposes
Maybe (Money a)
spouseIncomeForSurchargePurposes
(forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (IncomeTests a)
incomeTests forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Lens' (IncomeTests a) Integer
dependentChildren) TaxReturnInfo y a
info)
(forall {k} (y :: k) a.
TaxTables y a -> PrivateHealthInsuranceRebateRates a
ttPHIRebateRates TaxTables y a
tables)
(forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a.
Lens' (TaxReturnInfo y a) [PrivateHealthInsurancePolicyDetail a]
privateHealthInsurancePolicyDetails TaxReturnInfo y a
info)
foreignIncomeTaxOffsetLimit :: Money a
foreignIncomeTaxOffsetLimit =
let
step1 :: Money a
step1 = Money a
due forall a. Semigroup a => a -> a -> a
<> Money a
mlAndMLS
step2 :: Money a
step2 =
let
info' :: TaxReturnInfo y a
info' = TaxReturnInfo y a
info forall a b. a -> (a -> b) -> b
& forall s t a b. ASetter s t a b -> b -> s -> t
set forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Money a)
foreignIncome forall a. Monoid a => a
mempty
taxable' :: Money a
taxable' = forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasIncome a b c =>
Getter (a b) (Money c)
income TaxReturnInfo y a
info' forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Deductions a)
deductions forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Lens' (Deductions a) (Money a)
foreignIncomeDeductions) TaxReturnInfo y a
info'
due' :: Money a
due' = forall a b. Tax a b -> a -> b
getTax (forall {k} a (y :: k).
(Fractional a, Ord a) =>
TaxTables y a -> Tax (Money a) (Money a)
individualTax TaxTables y a
tables) Money a
taxable'
mlAndMLS' :: Money a
mlAndMLS' = forall a b. Tax a b -> a -> b
getTax (forall (y :: Year) a.
(DaysInYear y, Fractional a) =>
TaxTables y a -> TaxReturnInfo y a -> Tax (Money a) (Money a)
medicareLevyTax TaxTables y a
tables TaxReturnInfo y a
info') Money a
taxable'
in
Money a
due' forall a. Semigroup a => a -> a -> a
<> Money a
mlAndMLS'
step3 :: Money a
step3 = Money a
step1 forall a. Num a => Money a -> Money a -> Money a
$-$ Money a
step2
in
forall a. Ord a => a -> a -> a
max (forall num. num -> Money num
Money a
1000) Money a
step3
frankingCredit :: Money a
frankingCredit =
forall a. RealFrac a => Money a -> Money a
wholeDollars
forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap forall a. RealFrac a => Dividend a -> Money a
dividendFrankingCredit (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall (y :: Year) a. Lens' (TaxReturnInfo y a) [Dividend a]
dividends TaxReturnInfo y a
info)
off :: Money a
off =
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Offsets a)
offsets forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Lens' (Offsets a) (Money a)
spouseContributionOffset) TaxReturnInfo y a
info
forall a. Semigroup a => a -> a -> a
<> forall a. Ord a => a -> a -> a
min (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Offsets a)
offsets forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Lens' (Offsets a) (Money a)
foreignTaxOffset) TaxReturnInfo y a
info) Money a
foreignIncomeTaxOffsetLimit
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (forall (y :: Year) a. Lens' (TaxReturnInfo y a) (Offsets a)
offsets forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Lens' (Offsets a) (Money a)
paygInstalments) TaxReturnInfo y a
info
in
forall a.
Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> CGTAssessment a
-> Money a
-> TaxAssessment a
TaxAssessment
Money a
taxable
(Money a
due forall a. Semigroup a => a -> a -> a
<> Money a
studyRepayment)
Money a
mlAndMLS
(forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld TaxReturnInfo y a
info)
(Money a
frankingCredit forall a. Semigroup a => a -> a -> a
<> Money a
off)
CGTAssessment a
cg
Money a
phiAdj
type ABN = String
data PaymentSummary a = PaymentSummary
{ forall a. PaymentSummary a -> ABN
summaryABN :: ABN
, forall a. PaymentSummary a -> Money a
summaryGross :: Money a
, forall a. PaymentSummary a -> Money a
summaryWithheld :: Money a
, forall a. PaymentSummary a -> Money a
reportableEmployerSuperannuationContributions :: Money a
}
instance HasIncome PaymentSummary a a where
income :: Getter (PaymentSummary a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. PaymentSummary a -> Money a
summaryGross
instance HasTaxWithheld PaymentSummary a a where
taxWithheld :: Getter (PaymentSummary a) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a. PaymentSummary a -> Money a
summaryWithheld
newtype Proportion a = Proportion
{ forall a. Proportion a -> a
getProportion :: a
}
deriving (Int -> Proportion a -> ShowS
forall a. Show a => Int -> Proportion a -> ShowS
forall a. Show a => [Proportion a] -> ShowS
forall a. Show a => Proportion a -> ABN
forall a.
(Int -> a -> ShowS) -> (a -> ABN) -> ([a] -> ShowS) -> Show a
showList :: [Proportion a] -> ShowS
$cshowList :: forall a. Show a => [Proportion a] -> ShowS
show :: Proportion a -> ABN
$cshow :: forall a. Show a => Proportion a -> ABN
showsPrec :: Int -> Proportion a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Proportion a -> ShowS
Show, Proportion a -> Proportion a -> Bool
forall a. Eq a => Proportion a -> Proportion a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Proportion a -> Proportion a -> Bool
$c/= :: forall a. Eq a => Proportion a -> Proportion a -> Bool
== :: Proportion a -> Proportion a -> Bool
$c== :: forall a. Eq a => Proportion a -> Proportion a -> Bool
Eq, Proportion a -> Proportion a -> Bool
Proportion a -> Proportion a -> Ordering
Proportion a -> Proportion a -> Proportion a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Proportion a)
forall a. Ord a => Proportion a -> Proportion a -> Bool
forall a. Ord a => Proportion a -> Proportion a -> Ordering
forall a. Ord a => Proportion a -> Proportion a -> Proportion a
min :: Proportion a -> Proportion a -> Proportion a
$cmin :: forall a. Ord a => Proportion a -> Proportion a -> Proportion a
max :: Proportion a -> Proportion a -> Proportion a
$cmax :: forall a. Ord a => Proportion a -> Proportion a -> Proportion a
>= :: Proportion a -> Proportion a -> Bool
$c>= :: forall a. Ord a => Proportion a -> Proportion a -> Bool
> :: Proportion a -> Proportion a -> Bool
$c> :: forall a. Ord a => Proportion a -> Proportion a -> Bool
<= :: Proportion a -> Proportion a -> Bool
$c<= :: forall a. Ord a => Proportion a -> Proportion a -> Bool
< :: Proportion a -> Proportion a -> Bool
$c< :: forall a. Ord a => Proportion a -> Proportion a -> Bool
compare :: Proportion a -> Proportion a -> Ordering
$ccompare :: forall a. Ord a => Proportion a -> Proportion a -> Ordering
Ord)
proportion :: (Ord a, Num a) => a -> Proportion a
proportion :: forall a. (Ord a, Num a) => a -> Proportion a
proportion = forall a. a -> Proportion a
Proportion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ord a => a -> a -> a
max a
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ord a => a -> a -> a
min a
1
data Dividend a = Dividend
{ forall a. Dividend a -> ABN
dividendSource :: String
, forall a. Dividend a -> ABN
dividendDate :: String
, forall a. Dividend a -> Money a
dividendNetPayment :: Money a
, forall a. Dividend a -> Proportion a
dividendFrankedPortion :: Proportion a
, forall a. Dividend a -> Money a
dividendTaxWithheld :: Money a
}
deriving (Int -> Dividend a -> ShowS
forall a. Show a => Int -> Dividend a -> ShowS
forall a. Show a => [Dividend a] -> ShowS
forall a. Show a => Dividend a -> ABN
forall a.
(Int -> a -> ShowS) -> (a -> ABN) -> ([a] -> ShowS) -> Show a
showList :: [Dividend a] -> ShowS
$cshowList :: forall a. Show a => [Dividend a] -> ShowS
show :: Dividend a -> ABN
$cshow :: forall a. Show a => Dividend a -> ABN
showsPrec :: Int -> Dividend a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Dividend a -> ShowS
Show)
instance (RealFrac a) => HasTaxWithheld Dividend a a where
taxWithheld :: Getter (Dividend a) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (forall a. RealFrac a => Money a -> Money a
roundCents forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Dividend a -> Money a
dividendTaxWithheld)
dividendFrankingCredit :: (RealFrac a) => Dividend a -> Money a
dividendFrankingCredit :: forall a. RealFrac a => Dividend a -> Money a
dividendFrankingCredit Dividend a
d = forall a. RealFrac a => Money a -> Money a
roundCents forall a b. (a -> b) -> a -> b
$
(forall a. Proportion a -> a
getProportion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Dividend a -> Proportion a
dividendFrankedPortion) Dividend a
d
forall a. Num a => a -> Money a -> Money a
*$ forall a b. Tax a b -> a -> b
getTax forall a. Fractional a => Tax (Money a) (Money a)
corporateTax (forall a. Dividend a -> Money a
dividendNetPayment Dividend a
d forall a. Num a => Money a -> a -> Money a
$* (a
1 forall a. Fractional a => a -> a -> a
/ a
0.7))
instance (RealFrac a) => HasIncome Dividend a a where
income :: Getter (Dividend a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \Dividend a
d ->
forall a. RealFrac a => Money a -> Money a
roundCents (forall a. Dividend a -> Money a
dividendNetPayment Dividend a
d)
forall a. Semigroup a => a -> a -> a
<> forall a. RealFrac a => Dividend a -> Money a
dividendFrankingCredit Dividend a
d
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall {k} (a :: k -> *) (b :: k) c.
HasTaxWithheld a b c =>
Getter (a b) (Money c)
taxWithheld Dividend a
d
data Offsets a = Offsets
{ forall a. Offsets a -> Money a
_spouseOffset :: Money a
, forall a. Offsets a -> Money a
_foreignTaxOffset :: Money a
, forall a. Offsets a -> Money a
_paygInstalments :: Money a
}
instance Num a => Semigroup (Offsets a) where
Offsets Money a
a Money a
b Money a
c <> :: Offsets a -> Offsets a -> Offsets a
<> Offsets Money a
a' Money a
b' Money a
c' = forall a. Money a -> Money a -> Money a -> Offsets a
Offsets (Money a
a forall a. Semigroup a => a -> a -> a
<> Money a
a') (Money a
b forall a. Semigroup a => a -> a -> a
<> Money a
b') (Money a
c forall a. Semigroup a => a -> a -> a
<> Money a
c')
instance Num a => Monoid (Offsets a) where
mempty :: Offsets a
mempty = forall a. Money a -> Money a -> Money a -> Offsets a
Offsets forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
mappend :: Offsets a -> Offsets a -> Offsets a
mappend = forall a. Semigroup a => a -> a -> a
(<>)
spouseContributionOffset :: Lens' (Offsets a) (Money a)
spouseContributionOffset :: forall a. Lens' (Offsets a) (Money a)
spouseContributionOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Offsets a -> Money a
_spouseOffset (\Offsets a
s Money a
b -> Offsets a
s { _spouseOffset :: Money a
_spouseOffset = Money a
b })
foreignTaxOffset :: Lens' (Offsets a) (Money a)
foreignTaxOffset :: forall a. Lens' (Offsets a) (Money a)
foreignTaxOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Offsets a -> Money a
_foreignTaxOffset (\Offsets a
s Money a
b -> Offsets a
s { _foreignTaxOffset :: Money a
_foreignTaxOffset = Money a
b })
paygInstalments :: Lens' (Offsets a) (Money a)
paygInstalments :: forall a. Lens' (Offsets a) (Money a)
paygInstalments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Offsets a -> Money a
_paygInstalments (\Offsets a
s Money a
b -> Offsets a
s { _paygInstalments :: Money a
_paygInstalments = Money a
b })
data Deductions a = Deductions
{ forall a. Deductions a -> Money a
_workRelatedCarExpenses :: Money a
, forall a. Deductions a -> Money a
_workRelatedTravelExpenses :: Money a
, forall a. Deductions a -> Money a
_workRelatedClothingLaundryAndDryCleaningExpenses :: Money a
, forall a. Deductions a -> Money a
_workRelatedSelfEducationExpenses :: Money a
, forall a. Deductions a -> Money a
_otherWorkRelatedExpenses :: Money a
, forall a. Deductions a -> Money a
_lowValuePoolDeduction :: Money a
, forall a. Deductions a -> Money a
_interestDeductions :: Money a
, forall a. Deductions a -> Money a
_dividendDeductions :: Money a
, forall a. Deductions a -> Money a
_giftsOrDonations :: Money a
, forall a. Deductions a -> Money a
_costOfManagingTaxAffairs :: Money a
, forall a. Deductions a -> Money a
_deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity :: Money a
, forall a. Deductions a -> Money a
_personalSuperannuationContributions :: Money a
, forall a. Deductions a -> Money a
_deductionForProjectPool :: Money a
, forall a. Deductions a -> Money a
_forestryManagedInvestmentSchemeDeduction :: Money a
, forall a. Deductions a -> Money a
_otherDeductions :: Money a
, forall a. Deductions a -> Money a
_foreignIncomeDeductions :: Money a
}
instance Num a => Semigroup (Deductions a) where
Deductions Money a
a Money a
b Money a
c Money a
d Money a
e Money a
f Money a
g Money a
h Money a
i Money a
j Money a
k Money a
l Money a
m Money a
n Money a
o Money a
p
<> :: Deductions a -> Deductions a -> Deductions a
<> Deductions Money a
a' Money a
b' Money a
c' Money a
d' Money a
e' Money a
f' Money a
g' Money a
h' Money a
i' Money a
j' Money a
k' Money a
l' Money a
m' Money a
n' Money a
o' Money a
p'
= forall a.
Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Deductions a
Deductions (Money a
a forall a. Semigroup a => a -> a -> a
<> Money a
a') (Money a
b forall a. Semigroup a => a -> a -> a
<> Money a
b') (Money a
c forall a. Semigroup a => a -> a -> a
<> Money a
c') (Money a
d forall a. Semigroup a => a -> a -> a
<> Money a
d') (Money a
e forall a. Semigroup a => a -> a -> a
<> Money a
e') (Money a
f forall a. Semigroup a => a -> a -> a
<> Money a
f') (Money a
g forall a. Semigroup a => a -> a -> a
<> Money a
g') (Money a
h forall a. Semigroup a => a -> a -> a
<> Money a
h')
(Money a
i forall a. Semigroup a => a -> a -> a
<> Money a
i') (Money a
j forall a. Semigroup a => a -> a -> a
<> Money a
j') (Money a
k forall a. Semigroup a => a -> a -> a
<> Money a
k') (Money a
l forall a. Semigroup a => a -> a -> a
<> Money a
l') (Money a
m forall a. Semigroup a => a -> a -> a
<> Money a
m') (Money a
n forall a. Semigroup a => a -> a -> a
<> Money a
n') (Money a
o forall a. Semigroup a => a -> a -> a
<> Money a
o') (Money a
p forall a. Semigroup a => a -> a -> a
<> Money a
p')
instance Num a => Monoid (Deductions a) where
mempty :: Deductions a
mempty = forall a.
Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Deductions a
Deductions forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
totalDeductions :: (Num a, Ord a) => Deductions a -> Money a
totalDeductions :: forall a. (Num a, Ord a) => Deductions a -> Money a
totalDeductions Deductions a
a =
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (forall a. Ord a => a -> a -> a
max forall a. Monoid a => a
mempty)
[ forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
workRelatedCarExpenses Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
workRelatedTravelExpenses Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
workRelatedClothingLaundryAndDryCleaningExpenses Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
workRelatedSelfEducationExpenses Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
otherWorkRelatedExpenses Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
lowValuePoolDeduction Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
interestDeductions Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
dividendDeductions Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
giftsOrDonations Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
costOfManagingTaxAffairs Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
personalSuperannuationContributions Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
deductionForProjectPool Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
forestryManagedInvestmentSchemeDeduction Deductions a
a
, forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (Deductions a) (Money a)
otherDeductions Deductions a
a
]
workRelatedCarExpenses :: Lens' (Deductions a) (Money a)
workRelatedCarExpenses :: forall a. Lens' (Deductions a) (Money a)
workRelatedCarExpenses =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_workRelatedCarExpenses (\Deductions a
s Money a
b -> Deductions a
s { _workRelatedCarExpenses :: Money a
_workRelatedCarExpenses = Money a
b })
workRelatedTravelExpenses :: Lens' (Deductions a) (Money a)
workRelatedTravelExpenses :: forall a. Lens' (Deductions a) (Money a)
workRelatedTravelExpenses =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_workRelatedTravelExpenses (\Deductions a
s Money a
b -> Deductions a
s { _workRelatedTravelExpenses :: Money a
_workRelatedTravelExpenses = Money a
b })
workRelatedClothingLaundryAndDryCleaningExpenses :: Lens' (Deductions a) (Money a)
workRelatedClothingLaundryAndDryCleaningExpenses :: forall a. Lens' (Deductions a) (Money a)
workRelatedClothingLaundryAndDryCleaningExpenses =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
forall a. Deductions a -> Money a
_workRelatedClothingLaundryAndDryCleaningExpenses
(\Deductions a
s Money a
b -> Deductions a
s { _workRelatedClothingLaundryAndDryCleaningExpenses :: Money a
_workRelatedClothingLaundryAndDryCleaningExpenses = Money a
b })
workRelatedSelfEducationExpenses :: Lens' (Deductions a) (Money a)
workRelatedSelfEducationExpenses :: forall a. Lens' (Deductions a) (Money a)
workRelatedSelfEducationExpenses =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_workRelatedSelfEducationExpenses (\Deductions a
s Money a
b -> Deductions a
s { _workRelatedSelfEducationExpenses :: Money a
_workRelatedSelfEducationExpenses = Money a
b })
otherWorkRelatedExpenses :: Lens' (Deductions a) (Money a)
otherWorkRelatedExpenses :: forall a. Lens' (Deductions a) (Money a)
otherWorkRelatedExpenses =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_otherWorkRelatedExpenses (\Deductions a
s Money a
b -> Deductions a
s { _otherWorkRelatedExpenses :: Money a
_otherWorkRelatedExpenses = Money a
b })
lowValuePoolDeduction :: Lens' (Deductions a) (Money a)
lowValuePoolDeduction :: forall a. Lens' (Deductions a) (Money a)
lowValuePoolDeduction =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_lowValuePoolDeduction (\Deductions a
s Money a
b -> Deductions a
s { _lowValuePoolDeduction :: Money a
_lowValuePoolDeduction = Money a
b })
interestDeductions :: Lens' (Deductions a) (Money a)
interestDeductions :: forall a. Lens' (Deductions a) (Money a)
interestDeductions =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_interestDeductions (\Deductions a
s Money a
b -> Deductions a
s { _interestDeductions :: Money a
_interestDeductions = Money a
b })
dividendDeductions :: Lens' (Deductions a) (Money a)
dividendDeductions :: forall a. Lens' (Deductions a) (Money a)
dividendDeductions =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_dividendDeductions (\Deductions a
s Money a
b -> Deductions a
s { _dividendDeductions :: Money a
_dividendDeductions = Money a
b })
giftsOrDonations :: Lens' (Deductions a) (Money a)
giftsOrDonations :: forall a. Lens' (Deductions a) (Money a)
giftsOrDonations =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_giftsOrDonations (\Deductions a
s Money a
b -> Deductions a
s { _giftsOrDonations :: Money a
_giftsOrDonations = Money a
b })
costOfManagingTaxAffairs :: Lens' (Deductions a) (Money a)
costOfManagingTaxAffairs :: forall a. Lens' (Deductions a) (Money a)
costOfManagingTaxAffairs =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_costOfManagingTaxAffairs (\Deductions a
s Money a
b -> Deductions a
s { _costOfManagingTaxAffairs :: Money a
_costOfManagingTaxAffairs = Money a
b })
deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity :: Lens' (Deductions a) (Money a)
deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity :: forall a. Lens' (Deductions a) (Money a)
deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
forall a. Deductions a -> Money a
_deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity
(\Deductions a
s Money a
b -> Deductions a
s { _deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity :: Money a
_deductibleAmountOfUndeductedPurchasePriceOfAForeignPensionOrAnnuity = Money a
b })
personalSuperannuationContributions :: Lens' (Deductions a) (Money a)
personalSuperannuationContributions :: forall a. Lens' (Deductions a) (Money a)
personalSuperannuationContributions =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_personalSuperannuationContributions (\Deductions a
s Money a
b -> Deductions a
s { _personalSuperannuationContributions :: Money a
_personalSuperannuationContributions = Money a
b })
deductionForProjectPool :: Lens' (Deductions a) (Money a)
deductionForProjectPool :: forall a. Lens' (Deductions a) (Money a)
deductionForProjectPool =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_deductionForProjectPool (\Deductions a
s Money a
b -> Deductions a
s { _deductionForProjectPool :: Money a
_deductionForProjectPool = Money a
b })
forestryManagedInvestmentSchemeDeduction :: Lens' (Deductions a) (Money a)
forestryManagedInvestmentSchemeDeduction :: forall a. Lens' (Deductions a) (Money a)
forestryManagedInvestmentSchemeDeduction =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
forall a. Deductions a -> Money a
_forestryManagedInvestmentSchemeDeduction
(\Deductions a
s Money a
b -> Deductions a
s { _forestryManagedInvestmentSchemeDeduction :: Money a
_forestryManagedInvestmentSchemeDeduction = Money a
b })
otherDeductions :: Lens' (Deductions a) (Money a)
otherDeductions :: forall a. Lens' (Deductions a) (Money a)
otherDeductions =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_otherDeductions (\Deductions a
s Money a
b -> Deductions a
s { _otherDeductions :: Money a
_otherDeductions = Money a
b })
foreignIncomeDeductions :: Lens' (Deductions a) (Money a)
foreignIncomeDeductions :: forall a. Lens' (Deductions a) (Money a)
foreignIncomeDeductions =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. Deductions a -> Money a
_foreignIncomeDeductions (\Deductions a
s Money a
b -> Deductions a
s { _foreignIncomeDeductions :: Money a
_foreignIncomeDeductions = Money a
b })
data GrossAndWithheld a = GrossAndWithheld (Money a) (Money a)
instance (Num a) => Semigroup (GrossAndWithheld a) where
GrossAndWithheld Money a
a Money a
b <> :: GrossAndWithheld a -> GrossAndWithheld a -> GrossAndWithheld a
<> GrossAndWithheld Money a
a' Money a
b' =
forall a. Money a -> Money a -> GrossAndWithheld a
GrossAndWithheld (Money a
a forall a. Semigroup a => a -> a -> a
<> Money a
a') (Money a
b forall a. Semigroup a => a -> a -> a
<> Money a
b')
instance (Num a) => Monoid (GrossAndWithheld a) where
mempty :: GrossAndWithheld a
mempty = forall a. Money a -> Money a -> GrossAndWithheld a
GrossAndWithheld forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
mappend :: GrossAndWithheld a -> GrossAndWithheld a -> GrossAndWithheld a
mappend = forall a. Semigroup a => a -> a -> a
(<>)
instance HasIncome GrossAndWithheld a a where
income :: Getter (GrossAndWithheld a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \(GrossAndWithheld Money a
a Money a
_) -> Money a
a
instance HasTaxWithheld GrossAndWithheld a a where
taxWithheld :: Getter (GrossAndWithheld a) (Money a)
taxWithheld = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \(GrossAndWithheld Money a
_ Money a
a) -> Money a
a
data ESSStatement a = ESSStatement
{ forall a. ESSStatement a -> Money a
_taxedUpfrontReduction :: Money a
, forall a. ESSStatement a -> Money a
_taxedUpfrontNoReduction :: Money a
, forall a. ESSStatement a -> Money a
_deferral :: Money a
, forall a. ESSStatement a -> Money a
_pre2009 :: Money a
, forall a. ESSStatement a -> Money a
_tfnAmounts :: Money a
, forall a. ESSStatement a -> Money a
_foreignSourceDiscounts :: Money a
}
newESSStatement :: Num a => ESSStatement a
newESSStatement :: forall a. Num a => ESSStatement a
newESSStatement = forall a.
Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> ESSStatement a
ESSStatement forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty forall a. Monoid a => a
mempty
essTaxedUpfrontReduction :: Lens' (ESSStatement a) (Money a)
essTaxedUpfrontReduction :: forall a. Lens' (ESSStatement a) (Money a)
essTaxedUpfrontReduction =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_taxedUpfrontReduction (\ESSStatement a
s Money a
b -> ESSStatement a
s { _taxedUpfrontReduction :: Money a
_taxedUpfrontReduction = Money a
b })
essTaxedUpfrontNoReduction :: Lens' (ESSStatement a) (Money a)
essTaxedUpfrontNoReduction :: forall a. Lens' (ESSStatement a) (Money a)
essTaxedUpfrontNoReduction =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_taxedUpfrontNoReduction (\ESSStatement a
s Money a
b -> ESSStatement a
s { _taxedUpfrontNoReduction :: Money a
_taxedUpfrontNoReduction = Money a
b })
essDeferral :: Lens' (ESSStatement a) (Money a)
essDeferral :: forall a. Lens' (ESSStatement a) (Money a)
essDeferral = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_deferral (\ESSStatement a
s Money a
b -> ESSStatement a
s { _deferral :: Money a
_deferral = Money a
b })
essPre2009 :: Lens' (ESSStatement a) (Money a)
essPre2009 :: forall a. Lens' (ESSStatement a) (Money a)
essPre2009 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_pre2009 (\ESSStatement a
s Money a
b -> ESSStatement a
s { _pre2009 :: Money a
_pre2009 = Money a
b })
essTFNAmounts :: Lens' (ESSStatement a) (Money a)
essTFNAmounts :: forall a. Lens' (ESSStatement a) (Money a)
essTFNAmounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_tfnAmounts (\ESSStatement a
s Money a
b -> ESSStatement a
s { _tfnAmounts :: Money a
_tfnAmounts = Money a
b })
essForeignSourceDiscounts :: Lens' (ESSStatement a) (Money a)
essForeignSourceDiscounts :: forall a. Lens' (ESSStatement a) (Money a)
essForeignSourceDiscounts =
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall a. ESSStatement a -> Money a
_foreignSourceDiscounts (\ESSStatement a
s Money a
b -> ESSStatement a
s { _foreignSourceDiscounts :: Money a
_foreignSourceDiscounts = Money a
b })
instance (Num a) => HasIncome ESSStatement a a where
income :: Getter (ESSStatement a) (Money a)
income = forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to forall a b. (a -> b) -> a -> b
$ \ESSStatement a
s ->
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (ESSStatement a) (Money a)
essTaxedUpfrontReduction ESSStatement a
s
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (ESSStatement a) (Money a)
essTaxedUpfrontNoReduction ESSStatement a
s
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (ESSStatement a) (Money a)
essDeferral ESSStatement a
s
forall a. Semigroup a => a -> a -> a
<> forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (ESSStatement a) (Money a)
essPre2009 ESSStatement a
s
instance (Num a) => Semigroup (ESSStatement a) where
ESSStatement Money a
a Money a
b Money a
c Money a
d Money a
e Money a
f <> :: ESSStatement a -> ESSStatement a -> ESSStatement a
<> ESSStatement Money a
a' Money a
b' Money a
c' Money a
d' Money a
e' Money a
f' =
forall a.
Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> Money a
-> ESSStatement a
ESSStatement (Money a
a forall a. Semigroup a => a -> a -> a
<> Money a
a') (Money a
b forall a. Semigroup a => a -> a -> a
<> Money a
b') (Money a
c forall a. Semigroup a => a -> a -> a
<> Money a
c') (Money a
d forall a. Semigroup a => a -> a -> a
<> Money a
d') (Money a
e forall a. Semigroup a => a -> a -> a
<> Money a
e') (Money a
f forall a. Semigroup a => a -> a -> a
<> Money a
f')
instance (Num a) => Monoid (ESSStatement a) where
mempty :: ESSStatement a
mempty = forall a. Num a => ESSStatement a
newESSStatement
mappend :: ESSStatement a -> ESSStatement a -> ESSStatement a
mappend = forall a. Semigroup a => a -> a -> a
(<>)