packages feed

regex-genex 0.3.1 → 0.3.2

raw patch · 3 files changed

+15/−14 lines, 3 filesdep −haskell98dep ~sbvPVP ok

version bump matches the API change (PVP)

Dependencies removed: haskell98

Dependency ranges changed: sbv

API changes (from Hackage documentation)

Files

regex-genex.cabal view
@@ -1,5 +1,5 @@ Name            : regex-genex-Version         : 0.3.1+Version         : 0.3.2 license         : OtherLicense license-file    : LICENSE cabal-version   : >= 1.6@@ -20,14 +20,14 @@     other-modules:    Regex.Genex.Pure     extensions      : ImplicitParams, NamedFieldPuns, ParallelListComp, PatternGuards, RecordWildCards     build-depends:-        base >= 3 && < 5, haskell98, mtl, containers, sbv, regex-tdfa, stream-monad, text, logict+        base >= 3 && < 5, mtl, containers, sbv >= 0.9.22, regex-tdfa, stream-monad, text, logict  executable genex     main-is:            Main.hs     hs-source-dirs:     . src     extensions      : ImplicitParams, NamedFieldPuns, ParallelListComp, PatternGuards, RecordWildCards     build-depends:-        base >= 3 && < 5, haskell98, mtl, containers, sbv, regex-tdfa+        base >= 3 && < 5, mtl, containers, sbv, regex-tdfa  source-repository head   type:     git
src/Regex/Genex.hs view
@@ -138,8 +138,8 @@  exactMatch :: (?pats :: [(Pattern, GroupLens)]) => Len -> Symbolic SBool exactMatch len = do-    str <- mkFreeVars $ fromEnum len-    initialFlips <- mkFreeVars 1+    str <- mkExistVars $ fromEnum len+    initialFlips <- mkExistVars 1     captureAt <- newArray_ (Just minBound)     captureLen <- newArray_ (Just minBound)     let ?str = str@@ -346,10 +346,10 @@              (isWordCharAt (pos-1) <+> isWordCharAt pos)  -displayString :: [SMTResult] -> Hits -> (Hits -> IO ()) -> IO ()+displayString :: [SatResult] -> Hits -> (Hits -> IO ()) -> IO () displayString [] a next = next a displayString (r:rs) a next = do-    let (chars, rank) = getModel r+    let Right (chars, rank) = getModel r     putStr $ show (length (chars :: [Word8])) ++ "."     let n = show (rank :: Word64)     putStr (replicate (8 - length n) '0')@@ -361,7 +361,7 @@     where     chr = Data.Char.chr . fromEnum -genexWith :: Monoid a => ([SMTResult] -> Hits -> (Hits -> IO a) -> IO a) -> [[Char]] -> IO a+genexWith :: Monoid a => ([SatResult] -> Hits -> (Hits -> IO a) -> IO a) -> [[Char]] -> IO a genexWith f regexes = do     let ?grp = mempty     let p'lens = [ ((p', groupLens), lens)@@ -377,20 +377,20 @@     Monoid a => ResultHandler a -> [Len] -> Hits -> IO a tryWith _ [] _ = return mempty tryWith f (len:lens) acc = if len > maxLength then return mempty else do-    AllSatResult allRes <- allSat $ exactMatch len-    f allRes acc $ tryWith f lens+    AllSatResult (_, allRes) <- allSat $ exactMatch len+    f (map SatResult allRes) acc $ tryWith f lens -type ResultHandler a = [SMTResult] -> Hits -> (Hits -> IO a) -> IO a+type ResultHandler a = [SatResult] -> Hits -> (Hits -> IO a) -> IO a -getStringWith :: (Model -> a) -> [SMTResult] -> Hits -> (Hits -> IO [a]) -> IO [a]+getStringWith :: (Model -> a) -> [SatResult] -> Hits -> (Hits -> IO [a]) -> IO [a] getStringWith _ [] a next = next a getStringWith f (r:rs) a next = do-    let (chars, rank) = getModel r+    let Right (chars, rank) = getModel r     rest <- if (a+1 >= maxHits) then return [] else         unsafeInterleaveIO $ getStringWith f rs (a+1) next     return (f (Model chars rank):rest) -getString :: [SMTResult] -> Hits -> (Hits -> IO [String]) -> IO [String]+getString :: [SatResult] -> Hits -> (Hits -> IO [String]) -> IO [String] getString = getStringWith $ \Model{ modelChars } -> map chr modelChars     where     chr = Data.Char.chr . fromEnum
src/Regex/Genex/Pure.hs view
@@ -29,6 +29,7 @@  run :: Pattern -> Stream T.Text run p = case p of+    PEmpty -> pure T.empty     PChar{..} -> isChar getPatternChar     PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> each $ map T.singleton $ Set.toList cset     PQuest p -> pure T.empty <|> run p