packages feed

matchers 0.20.0.0 → 0.22.0.0

raw patch · 9 files changed

+26/−302 lines, 9 filesdep −parsecdep −timedep ~prednotedep ~textPVP ok

version bump matches the API change (PVP)

Dependencies removed: parsec, time

Dependency ranges changed: prednote, text

API changes (from Hackage documentation)

- Matchers: anyTime :: Pred Text
- Matchers: time :: UTCTime -> Ordering -> Pred Text
- Matchers.Times: colon :: Char -> Bool
- Matchers.Times: dateSep :: Char -> Bool
- Matchers.Times: dateTime :: Parser UTCTime
- Matchers.Times: day :: Parser Int
- Matchers.Times: digit :: Char -> Bool
- Matchers.Times: hours :: Parser Int
- Matchers.Times: minutes :: Parser Int
- Matchers.Times: month :: Parser Int
- Matchers.Times: pDate :: Parser Day
- Matchers.Times: seconds :: Parser Pico
- Matchers.Times: time :: Parser TimeOfDay
- Matchers.Times: timeWithZone :: Parser (TimeOfDay, Maybe TimeZone)
- Matchers.Times: timeZone :: Parser TimeZone
- Matchers.Times: tzNumber :: Parser Int
- Matchers.Times: tzSign :: Parser (Int -> Int)
- Matchers.Times: white :: Char -> Bool
- Matchers.Times: year :: Parser Integer

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011-2013 Omari Norman.+Copyright (c) 2011-2015 Omari Norman. All rights reserved.  Redistribution and use in source and binary forms, with or without
− README
@@ -1,3 +0,0 @@-This package contains helpers for performing text matches using-regular expressions as well as simpler matching that sees if a-particular substring exists within a larger string.
+ README.md view
@@ -0,0 +1,17 @@+# matchers++This package contains helpers for performing text matches using+regular expressions as well as simpler matching that sees if a+particular substring exists within a larger string.++It was written mostly for use with+[Penny](http://www.github.com/massysett/penny) so it doesn't have much+of a stable API.++## Test results++[![Build Status](https://travis-ci.org/massysett/matchers.svg?branch=master)](https://travis-ci.org/massysett/matchers)++The link above takes you to the archive of Travis build results.  If+you have trouble building matchers, look there, as it will show you+what dependencies were successfully used in past builds.
− current-versions.txt
@@ -1,50 +0,0 @@-This package was tested to work with these dependency-versions and compiler version.-These are the default versions fetched by cabal install.-Tested as of: 2014-07-17 02:09:19.042404 UTC-Path to compiler: ghc-7.8.3-Compiler description: 7.8.3--/opt/ghc/7.8.3/lib/ghc-7.8.3/package.conf.d:-    Cabal-1.18.1.3-    array-0.5.0.0-    base-4.7.0.1-    bin-package-db-0.0.0.0-    binary-0.7.1.0-    rts-1.0-    bytestring-0.10.4.0-    containers-0.5.5.1-    deepseq-1.3.0.2-    directory-1.2.1.0-    filepath-1.3.0.2-    (ghc-7.8.3)-    ghc-prim-0.3.1.0-    haskeline-0.7.1.2-    (haskell2010-1.1.2.0)-    (haskell98-2.0.0.3)-    hoopl-3.10.0.1-    hpc-0.6.0.1-    integer-gmp-0.5.1.0-    old-locale-1.0.0.6-    old-time-1.1.0.2-    pretty-1.1.1.1-    process-1.2.0.0-    template-haskell-2.9.0.0-    terminfo-0.4.0.0-    time-1.4.2-    transformers-0.3.0.0-    unix-2.7.0.1-    xhtml-3000.2.1--/home/massysett/matchers/sunlight-7904/db:-    contravariant-0.6-    matchers-0.20.0.0-    mtl-2.2.1-    parsec-3.1.5-    prednote-0.24.0.0-    rainbow-0.14.0.2-    split-0.2.2-    text-1.1.1.3-    transformers-0.4.1.0-    transformers-compat-0.3.3.4-
lib/Matchers.hs view
@@ -4,17 +4,11 @@   , pcre   , within   , exact-  , anyTime-  , time   ) where  import Data.Text (Text, pack, toCaseFold, isInfixOf)-import qualified Text.Parsec as P-import qualified Data.Time as Time-import Matchers.Times (dateTime) import Matchers.Pcre as PCRE import qualified Prednote as R-import qualified Prednote.Comparisons as R import Matchers.Types import Data.Monoid @@ -73,32 +67,3 @@       where         txt = flipCase t         pat = flipCase p----- | Matches any valid time.-anyTime :: R.Pred Text-anyTime = R.predicate st dyn pd-  where-    st = "is any valid date or time"-    dyn x = "text " <> pack (show x) <> " - " <> st-    pd x = case P.parse dateTime "" x of-      Left _ -> False-      Right _ -> True---- | If the given ordering is @r@, the given time is @t@, and the--- time of the subject is @s@, the Predbox returns @compare s t == r@.--- Always returns False if the subject is not a valid time.-time-  :: Time.UTCTime-  -- ^ @t@-  -> Ordering-  -- ^ @r@-  -> R.Pred Text-time ti ord = R.compareByMaybe "time" descRhs descLhs cmp ord-  where-    descRhs = pack . show $ ti-    descLhs = pack . show-    cmp x = case P.parse dateTime "" x of-      Left _ -> Nothing-      Right g -> Just $ (g `compare` ti)-
− lib/Matchers/Times.hs
@@ -1,139 +0,0 @@--- | Time parsers.------ "Matchers" allows you to perform matching based on times.--- Times are parsed using the parsers in this module.-module Matchers.Times where--import Data.Fixed-import Data.Maybe-import Control.Applicative-import Control.Monad-import qualified Data.Time as Time-import Text.Parsec (satisfy)-import qualified Text.Parsec as P-import Text.Parsec.Text (Parser)---- | A four-digit year.-year :: Parser Integer-year = read <$> replicateM 4 P.digit---- | A two-digit month (exactly 2 digits.)-month :: Parser Int-month = read <$> replicateM 2 P.digit---- | A two-digit day (exactly 2 digits.)-day :: Parser Int-day = read <$> replicateM 2 P.digit---- | A valid Gregorian day, in YYYY-MM-DD format.  Each separator--- may be a hyphen or a slash.  Fails if the day is not valid.-pDate :: Parser Time.Day-pDate = p >>= failOnErr-  where-    p = Time.fromGregorianValid-        <$> year  <* satisfy dateSep-        <*> month <* satisfy dateSep-        <*> day-    failOnErr = maybe (fail "could not parse date") return---- | Date separator (slash or hyphen).-dateSep :: Char -> Bool-dateSep c = c == '/' || c == '-'--digit :: Char -> Bool-digit c = c >= '0' && c <= '9'--colon :: Char -> Bool-colon = (== ':')---- | Two digits for the hour (exactly two digits).  Must be between--- 0 and 23.-hours :: Parser Int-hours = p >>= (maybe (fail "could not parse hours") return)-  where-    p = f <$> satisfy digit <*> satisfy digit-    f d1 d2 =-      let r = read [d1,d2]-      in if r < 0 || r > 23-         then Nothing-         else Just r----- | Two digits for the minutes (exactly two digits).  Must be--- between 0 and 59.-minutes :: Parser Int-minutes = p >>= maybe (fail "could not parse minutes") return-  where-    p = f <$ satisfy colon <*> satisfy digit <*> satisfy digit-    f d1 d2 =-      let r = read [d1, d2]-      in if r < 0 || r > 59-         then Nothing-         else Just r---- | Two digits for seconds (exactly two digits).  Must be between 0--- and 59; there are no leap seconds.-seconds :: Parser Pico-seconds = p >>= maybe (fail "could not parse seconds") return-  where-    p = f <$ satisfy colon <*> satisfy digit <*> satisfy digit-    f d1 d2 =-      let r = read [d1, d2] :: Int-      in if r < 0 || r > 59-         then Nothing-         else Just . fromIntegral $ r---- | Hours and minutes, separated by colons, with optional seconds.-time :: Parser Time.TimeOfDay-time = f <$> hours <*> minutes <*> optional seconds-  where-    f h m ms = Time.TimeOfDay h m (fromMaybe 0 ms)---- | Time zone sign, plus or minus.-tzSign :: Parser (Int -> Int)-tzSign = (id <$ satisfy plus) <|> (negate <$ satisfy minus)-  where-    plus = (== '+')-    minus = (== '-')---- | Time zone offset, exactly 4 digits.-tzNumber :: Parser Int-tzNumber = read <$> replicateM 4 (satisfy digit)---- | Time zone; that is, sign and offset.  Both the sign and offset--- are required.  The number of minutes may not exceed 840.-timeZone :: Parser Time.TimeZone-timeZone = p >>= maybe (fail "could not parse time zone") return-  where-    p = f <$> tzSign <*> tzNumber-    f s = minsToOffset . s-    minsToOffset m = if abs m > 840-                     then Nothing-                     else Just (Time.TimeZone m False "")---- | Space or tab.-white :: Char -> Bool-white c = c == ' ' || c == '\t'---- | Time of day, with optional time zone.-timeWithZone :: Parser (Time.TimeOfDay, Maybe Time.TimeZone)-timeWithZone =-  (,) <$> time <* many (satisfy white) <*> optional timeZone----- | Day, followed by optional whitespace, followed by optional time--- with zone.-dateTime :: Parser Time.UTCTime-dateTime =-  f <$> pDate <* many (satisfy white) <*> optional timeWithZone-  where-    f d mayTwithZ = Time.zonedTimeToUTC zt-      where-        zt = Time.ZonedTime lt tz-        lt = Time.LocalTime d tod-        (tod, tz) = case mayTwithZ of-          Nothing -> (Time.midnight, Time.utc)-          Just (t, mayZ) -> case mayZ of-            Nothing -> (t, Time.utc)-            Just z -> (t, z)-
matchers.cabal view
@@ -1,9 +1,9 @@ Name: matchers-Version: 0.20.0.0+Version: 0.22.0.0 Cabal-version: >=1.8 Build-Type: Simple License: BSD3-Copyright: 2012-2014 Omari Norman.+Copyright: 2011-2015 Omari Norman. author: Omari Norman maintainer: omari@smileystation.com stability: Experimental@@ -11,13 +11,14 @@ bug-reports: omari@smileystation.com Category: Console License-File: LICENSE-tested-with: GHC==7.4.1, GHC==7.6.3 synopsis: Text matchers extra-source-files:-  current-versions.txt minimum-versions.txt sunlight-test.hs-  README+  README.md  description: Helpers for performing text matches.+  For more information, please see the Github homepage at+  .+  <http://www.github.com/massysett/matchers>  source-repository head     type: git@@ -27,17 +28,14 @@     Build-depends:           base >=4.5.0.0 && < 5         , bytestring >=0.9.2.1 && < 0.11-        , parsec >= 3.1.2 && < 3.2-        , text >=0.11.2.0 && < 1.2-        , time >=1.4 && < 1.5-        , prednote >= 0.24.0.0 && < 0.25+        , text >=0.11.2.0 && < 1.3+        , prednote >= 0.26.0.0 && < 0.27       Exposed-modules:         Matchers       , Matchers.Pcre       , Matchers.Pcre.Base-      , Matchers.Times       , Matchers.Types     extra-libraries: pcre
− minimum-versions.txt
@@ -1,49 +0,0 @@-This package was tested to work with these dependency-versions and compiler version.-These are the minimum versions given in the .cabal file.-Tested as of: 2014-07-17 02:09:19.042404 UTC-Path to compiler: ghc-7.4.1-Compiler description: 7.4.1--/opt/ghc/7.4.1/lib/ghc-7.4.1/package.conf.d:-    Cabal-1.14.0-    array-0.4.0.0-    base-4.5.0.0-    bin-package-db-0.0.0.0-    binary-0.5.1.0-    bytestring-0.9.2.1-    containers-0.4.2.1-    deepseq-1.3.0.0-    directory-1.1.0.2-    extensible-exceptions-0.1.1.4-    filepath-1.3.0.0-    (ghc-7.4.1)-    ghc-prim-0.2.0.0-    (haskell2010-1.1.0.1)-    (haskell98-2.0.0.1)-    hoopl-3.8.7.3-    hpc-0.5.1.1-    integer-gmp-0.4.0.0-    old-locale-1.0.0.4-    old-time-1.1.0.0-    pretty-1.1.1.0-    process-1.1.0.1-    rts-1.0-    template-haskell-2.7.0.0-    time-1.4-    unix-2.5.1.0--/home/massysett/matchers/sunlight-7904/db:-    contravariant-0.6-    matchers-0.20.0.0-    mtl-2.2.1-    parsec-3.1.2-    prednote-0.24.0.0-    rainbow-0.14.0.2-    split-0.2.2-    tagged-0.7.2-    terminfo-0.4.0.0-    text-0.11.2.0-    transformers-0.4.1.0-    transformers-compat-0.3.3.4-
− sunlight-test.hs
@@ -1,15 +0,0 @@-module Main where--import Test.Sunlight--ghc v = (v, "ghc-" ++ v, "ghc-pkg-" ++ v)--inputs = TestInputs-  { tiDescription = Nothing-  , tiCabal = "cabal"-  , tiLowest = ghc "7.4.1"-  , tiDefault = [ ghc "7.4.1", ghc "7.6.3", ghc "7.8.3" ]-  , tiTest = []-  }--main = runTests inputs