Skip to content

Commit

Permalink
removing diagram and fixing ClockState being imported properly
Browse files Browse the repository at this point in the history
  • Loading branch information
travgm committed Nov 3, 2024
1 parent 33cc04d commit 0ddb41b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Lib/DecimalTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
-- Where D is decimal time, H is hour, M is minute, S is second
-----------------------------------------------------------------------------
module DecimalTime (
ClockState(..)
, updateCurrentDateWithZonedTime
updateCurrentDateWithZonedTime
, localTimeToDecimal
) where

Expand Down Expand Up @@ -102,6 +101,7 @@ localTimeToDecimal s = do
decimalMinutes :: Days -> Integer
decimalMinutes = round . (1000 -) . (* 1000)

-- | Transform zoned time to local time
-- | Set the current date with the ZonedTime
{-# INLINE updateCurrentDateWithZonedTime #-}
updateCurrentDateWithZonedTime :: ZonedTime -> ClockState -> ClockState
updateCurrentDateWithZonedTime zt state = state & (currentDate ?~ zonedTimeToLocalTime zt)
18 changes: 11 additions & 7 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,27 @@ import qualified Data.Text.IO as TIO
import qualified PrettyPrinter as Pretty (formatTime, displaySingleLine)
import qualified DecimalTime as DT (
localTimeToDecimal,
updateCurrentDateWithZonedTime,
ClockState(ClockState))
import Types (Config(..), RunMode(SingleRun, Watch))
updateCurrentDateWithZonedTime)
import Types (
ClockState( .. ),
Config(..),
RunMode(SingleRun,
Watch))

-- | Get platform information for version string
createPlatformText :: T.Text
createPlatformText = "(" <> T.pack arch <> "-" <> T.pack os <> ")"

-- | Show version information if the user types -v
-- | Show version information if the user types -v or --version
displayVersionText :: IO ()
displayVersionText =
TIO.putStrLn $
"Decimal time clock that maps your day to 1000 decimal minutes, "
<> "version 1.0.0 "
<> createPlatformText

-- | If any other command line argument other than -v or --version is given we show help
-- | If any other command line argument other than -v or --version, -e
-- or -w is given we show help
displayValidArgs :: IO ()
displayValidArgs = TIO.putStrLn "Valid arguments are: -e, -w, -v, --version"

Expand All @@ -64,7 +68,7 @@ zonedTime = construct $ do
zt <- liftIO getZonedTime
yield zt

-- | Process args or continue with running the machine
-- | Process args and run the clock
runClockProcess :: [String] -> IO ()
runClockProcess = \case
[] -> runWith $ Config False SingleRun
Expand All @@ -83,7 +87,7 @@ runClockProcess = \case

runClock :: Bool -> IO ()
runClock e = do
let state = DT.ClockState e Nothing Nothing
let state = ClockState e Nothing Nothing
runT_ $
zonedTime
~> M.mapping (`DT.updateCurrentDateWithZonedTime` state)
Expand Down
23 changes: 0 additions & 23 deletions diagram.md

This file was deleted.

0 comments on commit 0ddb41b

Please sign in to comment.