pcre-utils 0.1.5 → 0.1.6
raw patch · 2 files changed
+6/−6 lines, 2 filesdep ~mtlPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: mtl
API changes (from Hackage documentation)
- Text.Regex.PCRE.ByteString.Utils: instance Eq a => Eq (RegexpSplit a)
- Text.Regex.PCRE.ByteString.Utils: instance Functor RegexpSplit
- Text.Regex.PCRE.ByteString.Utils: instance Ord a => Ord (RegexpSplit a)
- Text.Regex.PCRE.ByteString.Utils: instance Show Replacement
- Text.Regex.PCRE.ByteString.Utils: instance Show a => Show (RegexpSplit a)
+ Text.Regex.PCRE.ByteString.Utils: instance GHC.Base.Functor Text.Regex.PCRE.ByteString.Utils.RegexpSplit
+ Text.Regex.PCRE.ByteString.Utils: instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.Regex.PCRE.ByteString.Utils.RegexpSplit a)
+ Text.Regex.PCRE.ByteString.Utils: instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.Regex.PCRE.ByteString.Utils.RegexpSplit a)
+ Text.Regex.PCRE.ByteString.Utils: instance GHC.Show.Show Text.Regex.PCRE.ByteString.Utils.Replacement
+ Text.Regex.PCRE.ByteString.Utils: instance GHC.Show.Show a => GHC.Show.Show (Text.Regex.PCRE.ByteString.Utils.RegexpSplit a)
Files
Text/Regex/PCRE/ByteString/Utils.hs view
@@ -29,7 +29,7 @@ import Text.Regex.PCRE.ByteString import qualified Data.ByteString.Char8 as BS-import Control.Monad.Error+import Control.Monad.Except import qualified Data.Vector as V import Data.Attoparsec.ByteString.Char8 as A import Control.Applicative@@ -46,7 +46,7 @@ -> BS.ByteString -- ^ The source string -> BS.ByteString -- ^ The replacement string -> IO (Either String BS.ByteString)-substitute regexp srcstring repla = runErrorT $ do+substitute regexp srcstring repla = runExceptT $ do parsedReplacement <- case parseOnly repparser repla of Right y -> return y Left rr -> throwError (rr ++ " when parsing the replacement string")@@ -76,7 +76,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 = either Left (Right . removeEmptyLeft . regexpUnmatched . fst) <$> runErrorT (getMatches regexp srcstring V.empty)+split regexp srcstring = fmap (removeEmptyLeft . regexpUnmatched . fst) <$> runExceptT (getMatches regexp srcstring V.empty) where removeEmptyLeft = reverse . dropWhile BS.null . reverse @@ -114,7 +114,7 @@ regexpUnmatched :: [RegexpSplit a] -> [a] regexpUnmatched = regexpAll . filter (not . isMatched) -getMatches :: Regex -> BS.ByteString -> V.Vector BS.ByteString -> ErrorT String IO ([RegexpSplit BS.ByteString], V.Vector BS.ByteString)+getMatches :: Regex -> BS.ByteString -> V.Vector BS.ByteString -> ExceptT String IO ([RegexpSplit BS.ByteString], V.Vector BS.ByteString) getMatches _ "" curcaptures = return ([], curcaptures) getMatches creg src curcaptures = do x <- liftIO $ regexec creg src
pcre-utils.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: pcre-utils-version: 0.1.5+version: 0.1.6 synopsis: Perl-like substitute and split for PCRE regexps. description: This package introduces split and replace like functions using PCRE regexps. license: BSD3@@ -23,7 +23,7 @@ exposed-modules: Text.Regex.PCRE.ByteString.Utils -- other-modules: ghc-options: -Wall- -- ghc-prof-options: -caf-all -auto-all+ ghc-prof-options: -caf-all -auto-all extensions: OverloadedStrings, BangPatterns build-depends: base >= 4.6 && < 4.9, regex-pcre-builtin >= 0.94.4.8, bytestring, attoparsec, mtl, vector, array