diff options
Diffstat (limited to 'repgoal.hs')
-rwxr-xr-x | repgoal.hs | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -12,6 +12,8 @@ | |||
12 | {-# language TemplateHaskell #-} | 12 | {-# language TemplateHaskell #-} |
13 | {-# language ViewPatterns #-} | 13 | {-# language ViewPatterns #-} |
14 | {-# language OverloadedStrings #-} | 14 | {-# language OverloadedStrings #-} |
15 | {-# language DeriveGeneric #-} | ||
16 | {-# language DerivingVia #-} | ||
15 | import Rebase.Prelude hiding (toList, on, (<+>), Max) | 17 | import Rebase.Prelude hiding (toList, on, (<+>), Max) |
16 | import qualified Rebase.Prelude as Prelude | 18 | import qualified Rebase.Prelude as Prelude |
17 | import Control.Lens hiding ((<|)) | 19 | import Control.Lens hiding ((<|)) |
@@ -63,19 +65,24 @@ import Brick.AttrMap as A | |||
63 | import Brick.Util (fg, bg, on, clamp) | 65 | import Brick.Util (fg, bg, on, clamp) |
64 | import Brick.Widgets.Core | 66 | import Brick.Widgets.Core |
65 | import Brick.Widgets.Table | 67 | import Brick.Widgets.Table |
68 | import Text.Pretty.Simple (pPrint) | ||
69 | |||
70 | import GHC.Generics (Generic) | ||
71 | import Generic.Data | ||
72 | import Generic.Data.Microsurgery | ||
66 | 73 | ||
67 | data Performance = Achieved { | 74 | data Performance = Achieved { |
68 | achievedReps :: Integer, | 75 | achievedReps :: Integer, |
69 | achievedWeight :: Rational | 76 | achievedWeight :: Rational |
70 | } | 77 | } deriving Generic deriving (Read, Show) via Surgery Derecordify Performance |
71 | 78 | ||
72 | data LiftRecord = LiftRecord { | 79 | data LiftRecord = LiftRecord { |
73 | liftName :: Text, | 80 | liftName :: Text, |
74 | stats :: [Performance] | 81 | stats :: [Performance] |
75 | } | 82 | } deriving Generic deriving (Read, Show) via Surgery Derecordify LiftRecord |
76 | 83 | ||
77 | initial :: [LiftRecord] | 84 | initial' :: [LiftRecord] |
78 | initial = | 85 | initial' = |
79 | [ | 86 | [ |
80 | LiftRecord "Squat" [Achieved 6 270, Achieved 8 255, Achieved 5 285, Achieved 10 255, Achieved 7 280], | 87 | LiftRecord "Squat" [Achieved 6 270, Achieved 8 255, Achieved 5 285, Achieved 10 255, Achieved 7 280], |
81 | LiftRecord "Bench" [Achieved 7 190, Achieved 9 180, Achieved 4 205, Achieved 11 180, Achieved 8 200], | 88 | LiftRecord "Bench" [Achieved 7 190, Achieved 9 180, Achieved 4 205, Achieved 11 180, Achieved 8 200], |
@@ -195,10 +202,12 @@ powerClean = clean * 80 / 100 | |||
195 | pushPress = press * 100 / 75 | 202 | pushPress = press * 100 / 75 |
196 | jerk = pushPress / 100 * 85 | 203 | jerk = pushPress / 100 * 85 |
197 | 204 | ||
198 | main :: IO () | 205 | main, main' :: IO () |
206 | main' = pPrint initial' | ||
199 | main = do | 207 | main = do |
200 | let buildVty = V.mkVty V.defaultConfig | 208 | let buildVty = V.mkVty V.defaultConfig |
201 | vty <- buildVty | 209 | vty <- buildVty |
202 | -- liftIO $ setMode (outputIface vty) Mouse True | 210 | -- liftIO $ setMode (outputIface vty) Mouse True |
203 | chan <- newBChan 10 | 211 | chan <- newBChan 10 |
212 | initial <- read <$> readFile "targets.dat" :: IO [LiftRecord] | ||
204 | void $ customMain vty buildVty (Just chan) (theApp) (St initial Week1) | 213 | void $ customMain vty buildVty (Just chan) (theApp) (St initial Week1) |