packages feed

period 0.1.0.4 → 0.1.0.5

raw patch · 2 files changed

+16/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

exec/period.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}  module Main where @@ -15,7 +16,11 @@  data Command   = Collapse PeriodFmt T.Text-  | Expand PeriodFmt T.Text+  | Expand {+    expandFmt :: PeriodFmt,+    expandInput :: T.Text,+    expandList :: Bool+  }  periodArg :: Parser T.Text periodArg = argument (T.pack <$> str) (metavar "PERIOD")@@ -39,9 +44,13 @@   [ mkCommand "collapse" "Find shortest representation for time period" $     Collapse <$> parseFmt <*> periodArg   , mkCommand "expand" "Display start and end points of time period" $-    Expand <$> parseFmt <*> periodArg+    Expand <$> parseFmt <*> periodArg <*> switch (long "list" <> help "List all days in the period")   ]  runCommand :: Command -> IO () runCommand (Collapse fmt per) = T.putStrLn $ collapsePeriod fmt $ parsePeriod per-runCommand (Expand fmt per) = T.putStrLn $ formatPeriod fmt $ parsePeriod per+runCommand (Expand fmt expandInput expandList) = if+  | expandList -> T.putStr . T.unlines . map (collapsePeriod fmt . (\x -> (x, x))) $ uncurry enumFromTo p+  | otherwise -> T.putStrLn $ formatPeriod fmt p+  where+  p = parsePeriod expandInput
period.cabal view
@@ -1,16 +1,16 @@ name:                period-version:             0.1.0.4+version:             0.1.0.5 synopsis:            Parse and format date periods, collapse and expand their text representations.--- description:         +-- description: homepage:            https://github.com/w3rs/period license:             BSD3 license-file:        LICENSE author:              Alexey Karakulov maintainer:          ankarakulov@gmail.com--- copyright:           +-- copyright: category:            Text build-type:          Simple--- extra-source-files:  +-- extra-source-files: cabal-version:       >=1.10  library