packages feed

pcre-utils 0.1.0.2 → 0.1.1

raw patch · 2 files changed

+6/−5 lines, 2 filesdep ~base

Dependency ranges changed: base

Files

Text/Regex/PCRE/ByteString/Utils.hs view
@@ -19,6 +19,7 @@ import qualified Data.Vector as V import Data.Attoparsec.ByteString.Char8 as A import Control.Applicative+import Data.Char (digitToInt)  {-| Substitutes values matched by a `Regex`. References can be used. @@ -55,7 +56,7 @@ split :: Regex  -- ^ The regular expression, taken from a call to `compile`       -> BS.ByteString -- ^ The source string       -> IO (Either String [BS.ByteString])-split regexp srcstring = fmap (either Left (Right . removeEmptyLeft . regexpUnmatched . fst)) $ runErrorT (getMatches regexp srcstring V.empty)+split regexp srcstring = either Left (Right . removeEmptyLeft . regexpUnmatched . fst) <$> runErrorT (getMatches regexp srcstring V.empty)     where         removeEmptyLeft = reverse . dropWhile BS.null . reverse @@ -92,7 +93,7 @@         Right (Just ("","",rm,_)) -> return (map (Unmatched . BS.singleton) (BS.unpack rm), curcaptures)          Right (Just (before,current,remaining,captures)) -> do-            (remain, nextcaptures) <- getMatches creg remaining (curcaptures V.++ (V.fromList captures))+            (remain, nextcaptures) <- getMatches creg remaining (curcaptures V.++ V.fromList captures)             return (Unmatched before : Matched current : remain, nextcaptures)  @@ -116,7 +117,7 @@             n <- anyChar             r <- rawData             return $ BS.cons n r-    fmap IndexedReplacement decimal <|> fmap (RawReplacement . BS.cons '\\') ac+    fmap (IndexedReplacement . digitToInt) digit <|> fmap (RawReplacement . BS.cons '\\') ac  -- | Compiles the regular expression (using default options) and `substitute`s substituteCompile :: BS.ByteString     -- ^ The regular expression
pcre-utils.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                pcre-utils-version:             0.1.0.2+version:             0.1.1 synopsis:            Perl-like substitute and split for PCRE regexps. description:         This package introduces split and replace like functions using PCRE regexps. license:             BSD3@@ -25,7 +25,7 @@   ghc-options:         -Wall   ghc-prof-options:    -caf-all -auto-all   extensions:          OverloadedStrings, BangPatterns-  build-depends:       base ==4.6.*, regex-pcre-builtin, bytestring, attoparsec, mtl, vector+  build-depends:       base >= 4.6 && < 4.8, regex-pcre-builtin, bytestring, attoparsec, mtl, vector  Test-Suite test-split     hs-source-dirs: test