matchers 0.16.0.0 → 0.18.0.0
raw patch · 4 files changed
+26/−31 lines, 4 filesdep ~prednote
Dependency ranges changed: prednote
Files
- Text/Matchers.hs +16/−21
- current-versions.txt +4/−4
- matchers.cabal +2/−2
- minimum-versions.txt +4/−4
Text/Matchers.hs view
@@ -12,7 +12,7 @@ import qualified Data.Time as Time import Text.Matchers.Times (dateTime) import Text.Matchers.Pcre as PCRE-import qualified Data.Prednote.Pdct as R+import qualified Data.Prednote.Predbox as R data CaseSensitive = Sensitive | Insensitive deriving (Eq, Ord, Show) @@ -28,8 +28,8 @@ -> Text -- ^ Pattern - -> Either Text (R.Pdct Text)- -- ^ The Pdct if the pattern is good; if the pattern is bad,+ -> Either Text (R.Predbox Text)+ -- ^ The Predbox if the pattern is good; if the pattern is bad, -- returns an error message. pcre c t = case PCRE.compile (c == Insensitive) t of@@ -38,7 +38,7 @@ let mrDesc = pack $ "matches the PCRE pattern \"" ++ unpack t ++ "\"" ++ descSensitive c mr = maybe False id . PCRE.exec r- in return $ R.operand mrDesc mr+ in return $ R.predicate mrDesc mr -- | Matcher that succeeds if the pattern text is found anywhere -- within the subject.@@ -48,8 +48,8 @@ -> Text -- ^ The pattern - -> R.Pdct Text-within cs t = R.operand mrDesc mr+ -> R.Predbox Text+within cs t = R.predicate mrDesc mr where mrDesc = pack $ "contains the text \"" ++ unpack t ++ "\"" ++ descSensitive cs@@ -57,8 +57,8 @@ -- | Matcher that succeeds if the pattern text exactly matches the -- subject (with case sensitivity as appropriate.)-exact :: CaseSensitive -> Text -> R.Pdct Text-exact cs t = R.operand mrDesc mr+exact :: CaseSensitive -> Text -> R.Predbox Text+exact cs t = R.predicate mrDesc mr where mrDesc = pack $ "matches the text \"" ++ unpack t ++ "\"" ++ descSensitive cs@@ -76,8 +76,8 @@ Insensitive -> toCaseFold -- | Matches any valid time.-anyTime :: R.Pdct Text-anyTime = R.operand mrDesc mr+anyTime :: R.Predbox Text+anyTime = R.predicate mrDesc mr where mrDesc = pack "any valid time" mr x = case P.parse dateTime "" x of@@ -85,23 +85,18 @@ Right _ -> True -- | If the given ordering is @r@, the given time is @t@, and the--- time of the subject is @s@, the Pdct returns @compare s t == r@.+-- 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 :: Ordering -- ^ @r@ -> Time.UTCTime -- ^ @t@- -> R.Pdct Text-time ord ti = R.operand mrDesc mr+ -> R.Predbox Text+time ord ti = R.compareByMaybe desc (pack "time") mr ord where- mrDesc = pack $ "subject time is " ++ d ++ " " ++ show ti- where- d = case ord of- EQ -> "equal to"- LT -> "less than"- GT -> "greater than"+ desc = pack . show $ ti mr x = case P.parse dateTime "" x of- Left _ -> False- Right g -> compare g ti == ord+ Left _ -> Nothing+ Right g -> Just $ (g `compare` ti)
current-versions.txt view
@@ -1,7 +1,7 @@ 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-03-01 20:03:17.979027 UTC+Tested as of: 2014-03-02 02:11:53.267528 UTC Path to compiler: ghc-7.6.3 Compiler description: 7.6.3 @@ -32,12 +32,12 @@ time-1.4.0.1 unix-2.6.0.1 -/home/massysett/matchers/sunlight-23118/db:+/home/massysett/matchers/sunlight-26440/db: contravariant-0.4.4- matchers-0.16.0.0+ matchers-0.18.0.0 mtl-2.1.2 parsec-3.1.5- prednote-0.20.0.0+ prednote-0.22.0.0 rainbow-0.6.0.4 split-0.2.2 tagged-0.7
matchers.cabal view
@@ -1,5 +1,5 @@ Name: matchers-Version: 0.16.0.0+Version: 0.18.0.0 Cabal-version: >=1.8 Build-Type: Simple License: BSD3@@ -28,7 +28,7 @@ base >=4.5.0.0 && < 5 , bytestring >=0.9.2.1 , parsec >= 3.1.2- , prednote >= 0.20.0.0+ , prednote >= 0.22.0.0 , text >=0.11.2.0 , time >=1.4
minimum-versions.txt view
@@ -1,7 +1,7 @@ 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-03-01 20:03:17.979027 UTC+Tested as of: 2014-03-02 02:11:53.267528 UTC Path to compiler: ghc-7.4.1 Compiler description: 7.4.1 @@ -33,12 +33,12 @@ time-1.4 unix-2.5.1.0 -/home/massysett/matchers/sunlight-23118/db:+/home/massysett/matchers/sunlight-26440/db: contravariant-0.4.4- matchers-0.16.0.0+ matchers-0.18.0.0 mtl-2.1.2 parsec-3.1.2- prednote-0.20.0.0+ prednote-0.22.0.0 rainbow-0.6.0.4 split-0.2.2 tagged-0.7