A2J7B4SCCJYKQV3G2LDHEFNE2GUICO3N3Y5FKF4EUZW5AG7PTDWAC newtype Months = Months IntegermonthsLength :: Months -> NominalDiffTimemonthsLength (Months i) = fromInteger $ 60 * 60 * 24 * 30 * ilinearDepreciation :: Months -> Months -> DepreciationlinearDepreciation undepPeriod depPeriod =let maxDepreciable :: NominalDiffTimemaxDepreciable = monthsLength undepPeriod + monthsLength depPeriod
linearDepreciation :: DepreciationlinearDepreciation =let depf = undefinedDepreciation depf
zeroTime :: NominalDiffTimezeroTime = fromInteger 0depf :: NominalDiffTime -> Rationaldepf dt = if dt < monthsLength undepPeriodthen 1else toRational (max zeroTime (maxDepreciable - dt)) / toRational maxDepreciablein Depreciation depf