homura-stopwatch 0.2.0 → 0.2.0.1
raw patch · 3 files changed
+10/−12 lines, 3 filesdep +time-hourglassdep −hourglassPVP ok
version bump matches the API change (PVP)
Dependencies added: time-hourglass
Dependencies removed: hourglass
API changes (from Hackage documentation)
Files
- README.md +4/−4
- homura-stopwatch.cabal +4/−6
- src/Lib.hs +2/−2
README.md view
@@ -4,7 +4,7 @@ ~~~shell echo "-10:30 10:40 tvirus+10:30 10:40 t-virus 10:40 12:28 icbm 12:28 14:59 gsomia 15:41 15:57 gsomia@@ -22,14 +22,14 @@ output ~~~shell-tvirus 0:10+t-virus 0:10 icbm 6:42 gsomia 3:45 panzer 0:38 ~~~ -区切りは`\n`でも`,`でもOKです.+区切りは`\n`でも`,`でもOKです。 ~~~shell-echo "10:30 10:40 tvirus, 10:40 12:28 icbm, 12:28 14:59 gsomia, 15:41 15:57 gsomia, 15:57 16:35 panzer, 16:35 17:17 icbm, 17:17 17:28 gsomia, 17:28 18:15 icbm, 18:15 18:42 gsomia, 18:42 19:44 icbm, 19:44 20:04 gsomia, 20:04 21:10 icbm, 22:10 23:27 icbm" | homura-stopwatch+echo "10:30 10:40 t-virus, 10:40 12:28 icbm, 12:28 14:59 gsomia, 15:41 15:57 gsomia, 15:57 16:35 panzer, 16:35 17:17 icbm, 17:17 17:28 gsomia, 17:28 18:15 icbm, 18:15 18:42 gsomia, 18:42 19:44 icbm, 19:44 20:04 gsomia, 20:04 21:10 icbm, 22:10 23:27 icbm" | homura-stopwatch ~~~
homura-stopwatch.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.38.0. -- -- see: https://github.com/sol/hpack------ hash: 4d34d81226128601c7d28a9324c8a893c66238bbc1219f147d3438e350ef29d0 name: homura-stopwatch-version: 0.2.0+version: 0.2.0.1 description: Please see the README on GitHub at <https://github.com/ncaq/homura-stopwatch#readme> homepage: https://github.com/ncaq/homura-stopwatch#readme bug-reports: https://github.com/ncaq/homura-stopwatch/issues@@ -35,8 +33,8 @@ ghc-options: -Wall -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-exported-signatures -Wmissing-home-modules -Wredundant-constraints -Wcompat build-depends: base >=4.7 && <5- , hourglass , split+ , time-hourglass default-language: Haskell2010 executable homura-stopwatch@@ -49,6 +47,6 @@ build-depends: base >=4.7 && <5 , homura-stopwatch- , hourglass , split+ , time-hourglass default-language: Haskell2010
src/Lib.hs view
@@ -31,11 +31,11 @@ [hs, ss] -> do h <- readMaybe hs s <- readMaybe ss- pure $ DateTime date $ TimeOfDay{todHour = Hours h, todMin = Minutes s, todSec = 0, todNSec = 0}+ pure $ DateTime date TimeOfDay{todHour = Hours h, todMin = Minutes s, todSec = 0, todNSec = 0} _ -> Nothing leftParse s = Left $ "次の時刻表記が認識できませんでした: " <> s in case (parse startStr, parse endStr) of- (Just workStart, Just workEnd) -> Right $ Work{workName = concat tl, workTime = workEnd `timeDiff` workStart}+ (Just workStart, Just workEnd) -> Right Work{workName = concat tl, workTime = workEnd `timeDiff` workStart} (Nothing, Just _) -> leftParse startStr (Just _, Nothing) -> leftParse endStr (Nothing, Nothing) -> leftParse $ startStr <> " && " <> endStr