A2J7B4SCCJYKQV3G2LDHEFNE2GUICO3N3Y5FKF4EUZW5AG7PTDWAC
newtype Months = Months Integer
monthsLength :: Months -> NominalDiffTime
monthsLength (Months i) = fromInteger $ 60 * 60 * 24 * 30 * i
linearDepreciation :: Months -> Months -> Depreciation
linearDepreciation undepPeriod depPeriod =
let maxDepreciable :: NominalDiffTime
maxDepreciable = monthsLength undepPeriod + monthsLength depPeriod
linearDepreciation :: Depreciation
linearDepreciation =
let depf = undefined
Depreciation depf
zeroTime :: NominalDiffTime
zeroTime = fromInteger 0
depf :: NominalDiffTime -> Rational
depf dt = if dt < monthsLength undepPeriod
then 1
else toRational (max zeroTime (maxDepreciable - dt)) / toRational maxDepreciable
in Depreciation depf