time-parsers 0.1.2.0 → 0.1.2.1
raw patch · 3 files changed
+65/−57 lines, 3 filesdep ~attoparsecdep ~basedep ~parsersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: attoparsec, base, parsers, tasty, template-haskell, time
API changes (from Hackage documentation)
Files
- CHANGELOG.md +3/−0
- src/Data/Time/Parsers.hs +19/−18
- time-parsers.cabal +43/−39
CHANGELOG.md view
@@ -1,3 +1,6 @@+- 0.1.2.1+ - Use `unexpected` instead of `fail`+ - 0.1.2.0 - add `month` - fix pre BCE parsing
src/Data/Time/Parsers.hs view
@@ -22,24 +22,25 @@ , DateParsing ) where -import Control.Applicative (optional, some, (<|>))-import Control.Monad (void, when)-import Data.Bits ((.&.))-import Data.Char (isDigit, ord)-import Data.Fixed (Pico)-import Data.Int (Int64)-import Data.List (foldl')-import Data.Maybe (fromMaybe)-import Data.Time.Calendar (Day, fromGregorianValid)-import Data.Time.Clock (UTCTime (..))-import Text.Parser.Char (CharParsing (..), digit)-import Text.Parser.LookAhead (LookAheadParsing (..))-import Unsafe.Coerce (unsafeCoerce)+import Control.Applicative (optional, some, (<|>))+import Control.Monad (void, when)+import Data.Bits ((.&.))+import Data.Char (isDigit, ord)+import Data.Fixed (Pico)+import Data.Int (Int64)+import Data.List (foldl')+import Data.Maybe (fromMaybe)+import Data.Time.Calendar (Day, fromGregorianValid)+import Data.Time.Clock (UTCTime (..))+import Text.Parser.Char (CharParsing (..), digit)+import Text.Parser.Combinators (unexpected)+import Text.Parser.LookAhead (LookAheadParsing (..))+import Unsafe.Coerce (unsafeCoerce) import qualified Data.Time.LocalTime as Local #if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((*>), (<$>), (<$), (<*), (<*>))+import Control.Applicative ((*>), (<$), (<$>), (<*), (<*>)) #endif type DateParsing m = (CharParsing m, LookAheadParsing m, Monad m)@@ -56,7 +57,7 @@ m <- twoDigits if (1 <= m && m <= 12) then return (s y, m)- else fail "Invalid month"+ else unexpected "Invalid month" {-# INLINE month #-} -- | Parse a date of the form @YYYY-MM-DD@.@@ -68,7 +69,7 @@ m <- twoDigits _ <- char '-' d <- twoDigits- maybe (fail "invalid date") return (fromGregorianValid (s y) m d)+ maybe (unexpected "invalid date") return (fromGregorianValid (s y) m d) -- | Parse a two-digit integer (e.g. day of month, hour). twoDigits :: DateParsing m => m Int@@ -86,7 +87,7 @@ s <- seconds if h < 24 && m < 60 && s < 61 then return (Local.TimeOfDay h m s)- else fail "invalid time"+ else unexpected "invalid time" data T = T {-# UNPACK #-} !Int {-# UNPACK #-} !Int64 @@ -131,7 +132,7 @@ _ | off == 0 -> return Nothing | off < -720 || off > 840 || m > 59 ->- fail "invalid time zone offset"+ unexpected "invalid time zone offset" | otherwise -> let !tz = Local.minutesToTimeZone off in return (Just tz)
time-parsers.cabal view
@@ -1,60 +1,64 @@-name: time-parsers-version: 0.1.2.0-synopsis: Parsers for types in `time`.+cabal-version: >=1.10+name: time-parsers+version: 0.1.2.1+synopsis: Parsers for types in `time`.+category: Parsing description: Parsers for types in `time` using 'parser' library. . Originally forked from aeson parsers.-category: Parsing-homepage: https://github.com/phadej/time-parsers#readme-bug-reports: https://github.com/phadej/time-parsers/issues-author: Oleg Grenrus <oleg.grenrus@iki.fi>-maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>-license: BSD3-license-file: LICENSE-tested-with: GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.1-build-type: Simple-cabal-version: >= 1.10+ .+ See also <http://hackage.haskell.org/package/attoparsec-iso8601 attoparsec-iso-8601> package. +homepage: https://github.com/phadej/time-parsers#readme+bug-reports: https://github.com/phadej/time-parsers/issues+author: Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>+license: BSD3+license-file: LICENSE+tested-with:+ GHC ==8.8.1 || ==8.6.5 || ==8.4.4 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3++build-type: Simple extra-source-files:- CHANGELOG.md- README.md+ CHANGELOG.md+ README.md source-repository head- type: git+ type: git location: https://github.com/phadej/time-parsers library- hs-source-dirs:- src- ghc-options: -Wall+ hs-source-dirs: src+ ghc-options: -Wall build-depends:- base >=4.6 && <4.10- , parsers >=0.12.2.1 && <0.13- , template-haskell >=2.8.0.0 && <2.12- , time >=1.4.2 && <1.7+ base >=4.6 && <4.13+ , parsers >=0.12.2.1 && <0.13+ , template-haskell >=2.8.0.0 && <2.15+ , time >=1.4.0.1 && <1.9+ exposed-modules:- Data.Time.Parsers- Data.Time.TH+ Data.Time.Parsers+ Data.Time.TH+ default-language: Haskell2010 test-suite date-parsers-tests- type: exitcode-stdio-1.0- main-is: Tests.hs- hs-source-dirs:- test- ghc-options: -Wall+ type: exitcode-stdio-1.0+ main-is: Tests.hs+ hs-source-dirs: test+ ghc-options: -Wall build-depends:- base- , parsers+ attoparsec >=0.12.1.6 && <0.14+ , base+ , bifunctors >=4.2.1 && <5.6+ , parsec >=3.1.9 && <3.2+ , parsers >=0.12.3 && <0.13+ , tasty >=0.10.1.2 && <1.3+ , tasty-hunit >=0.9.2 && <0.11 , template-haskell+ , text , time , time-parsers- , attoparsec >=0.12.1.6 && <0.14- , bifunctors >=4.2.1 && <5.5- , parsec >=3.1.9 && <3.2- , parsers >=0.12.3 && <0.13- , tasty >=0.10.1.2 && <0.12- , tasty-hunit >=0.9.2 && <0.10- , text+ default-language: Haskell2010