packages feed

Monadoro 0.3.5.0 → 0.3.6.0

raw patch · 4 files changed

+36/−40 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- CountdownLoop: countdown_loop :: IO () -> String -> IO String
+ CountdownLoop: countdownLoop :: IO () -> String -> IO String

Files

Monadoro.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           Monadoro-version:        0.3.5.0+version:        0.3.6.0 synopsis:       A minimalistic CLI Pomodoro timer. description:    A Pomodoro timer with two modes: single-pomodoro (default), and four-pomodoro (`--session`). category:       Tools
src/CLI.hs view
@@ -17,7 +17,7 @@ import System.Process     (system)  import Paths_Monadoro     (getDataFileName, version)-import CountdownLoop      (countdown_loop)+import CountdownLoop      (countdownLoop) import Pomodoro           (session)  showUsage :: IO ()@@ -37,8 +37,8 @@ runSession xs = session (getDelayIfNeeded xs)  runTimer :: IO () -> [String] -> IO ()-runTimer delayer []     = void (countdown_loop delayer "25:00")-runTimer delayer [t]    = void (countdown_loop delayer t)+runTimer delayer []     = void (countdownLoop delayer "25:00")+runTimer delayer [t]    = void (countdownLoop delayer t) runTimer delayer (t:ts) = runTimer delayer [t] >> runTimer delayer ts  filterParams :: [String] -> [String]@@ -120,8 +120,8 @@   | xs `containsEither` ["--nodelay", "-n"] = wait 0   | otherwise = wait 1 -milisec_per_second :: Int-milisec_per_second = 10 ^ (6 :: Int)+milisecPerSecond :: Int+milisecPerSecond = 10 ^ (6 :: Int)  wait :: Int -> IO()-wait n = threadDelay (n * milisec_per_second)+wait n = threadDelay (n * milisecPerSecond)
src/CountdownLoop.hs view
@@ -1,15 +1,16 @@ #!/usr/bin/env stack --stack --install-ghc runghc -module CountdownLoop       (countdown, countdown_loop) where+module CountdownLoop       (countdown, countdownLoop) where  import System.Environment  (getArgs) import Control.Concurrent  (threadDelay)+import Control.Monad       (void) import ParseTime           (count_down_time) import Display             (display) -milisec_per_second :: Int-milisec_per_second = 10 ^ (6 :: Int)+milisecPerSecond :: Int+milisecPerSecond = 10 ^ (6 :: Int)  {-| wait: Pauses for the given number of seconds. @@ -17,47 +18,47 @@ -}  wait :: Int -> IO()-wait n = threadDelay (n * milisec_per_second)+wait n = threadDelay (n * milisecPerSecond) -with_delay :: IO()-with_delay = wait 1+withDelay :: IO()+withDelay = wait 1  -- Mocks a delay for test purposes.-no_delay :: IO()-no_delay = wait 0+noDelay :: IO()+noDelay = wait 0 -{-| countdown_loop: Runs a Pomodoro timer.+{-| countdownLoop: Runs a Pomodoro timer. ->>> result <- countdown_loop no_delay "00:00"+>>> result <- countdownLoop noDelay "00:00" ... >>> result "00:00" ->>> result' <- countdown_loop no_delay "00:59"+>>> result' <- countdownLoop noDelay "00:59" ... >>> result' "00:00" ->>> result'' <- countdown_loop no_delay "01:59"+>>> result'' <- countdownLoop noDelay "01:59" ... >>> result'' "00:00"  -} -countdown :: String -> IO (String)-countdown = countdown_loop with_delay+countdown :: String -> IO String+countdown = countdownLoop withDelay -countdown_loop :: IO() -> String -> IO (String)-countdown_loop delayer "00:00" = display "00:00" >> return "00:00"-countdown_loop delayer s = do+countdownLoop :: IO() -> String -> IO String+countdownLoop delayer "00:00" = display "00:00" >> return "00:00"+countdownLoop delayer s = do   display s   delayer-  (countdown_loop delayer . count_down_time) s+  (countdownLoop delayer . count_down_time) s  parse :: [String] -> IO ()-parse [s] = countdown_loop with_delay s >> return ()-parse _   = countdown_loop with_delay "00:00" >> return ()+parse [s] = void (countdownLoop withDelay s)+parse _   = void (countdownLoop withDelay "00:00")  main :: IO () main = getArgs >>= parse
src/Pomodoro.lhs view
@@ -23,25 +23,20 @@ > >>> secToTimestamp 3000 > "50:00" > -}->+ > secToTimestamp :: Int -> String-> secToTimestamp = formatTime defaultTimeLocale "%M:%S" . posixSecondsToUTCTime . fromIntegral+> secToTimestamp = formatTime defaultTimeLocale "%M:%S"+>     . posixSecondsToUTCTime+>     . fromIntegral -> -- | Manage Pomodoro sessions-> ---> -- Examples:-> ---> -- >>> putStrLn "Hello world!"-> -- Hello world!-> ---> -- >>> putStrLn "Test complete!"-> -- Test complete!+For testing purposes, this function returns an empty action without delay. -> -- | Replace a delay with no delay for testing purposes.+Its type allows for drop-in replacement of the standard delay function.+ > no_del :: Int -> IO() > no_del _ = do >     return ()- + > pom :: Show a => IO () -> a -> IO () > pom delay m = do >     let prefix = show m ++ " pomodoro" ++ " | "