diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-16 23:53:30 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-16 23:53:30 -0400 |
commit | fc50d28c84fe7c79d47e89e93e959dbaa68cda5b (patch) | |
tree | aca07262bf025fd4ab54188841e7f75d05872624 /Cost.hs | |
parent | c2eba63d11c748aeebdd3a4a3a5b015ac5e2f2c9 (diff) | |
download | keysafe-fc50d28c84fe7c79d47e89e93e959dbaa68cda5b.tar.gz |
improve cost table
Diffstat (limited to 'Cost.hs')
-rw-r--r-- | Cost.hs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -102,3 +102,13 @@ costOverTime (Dollars currcost) thisyear = let monthdelta = (fromIntegral ((y * 12) - (thisyear * 12))) :: Double cost = floor $ fromIntegral currcost / 2 ** (monthdelta / 18) in (Dollars cost, y) + +costOverTimeTable :: Dollars -> Year -> [String] +costOverTimeTable cost thisyear = go [] thisyear $ costOverTime cost thisyear + where + go t _ [] = reverse t + go t yprev ((c, y):ys) = + let s = " " ++ show y ++ ":\t" ++ show c + in if yprev < y - 1 + then go (s:" ...":t) y ys + else go (s:t) y ys |