packages feed

weighted-regexp 0.3.0.0 → 0.3.0.1

raw patch · 5 files changed

+65/−34 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Semiring: instance (Eq a) => Eq (Numeric a)
- Data.Semiring: instance (Num a) => Num (Numeric a)
- Data.Semiring: instance (Num a) => Semiring (Numeric a)
- Data.Semiring: instance (Show a) => Show (Numeric a)
+ Data.Semiring: instance Eq a => Eq (Numeric a)
+ Data.Semiring: instance Num a => Num (Numeric a)
+ Data.Semiring: instance Num a => Semiring (Numeric a)
+ Data.Semiring: instance Show a => Show (Numeric a)
- Data.Semiring: (.*.) :: (Semiring s) => s -> s -> s
+ Data.Semiring: (.*.) :: Semiring s => s -> s -> s
- Data.Semiring: (.+.) :: (Semiring s) => s -> s -> s
+ Data.Semiring: (.+.) :: Semiring s => s -> s -> s
- Data.Semiring: class (Eq s) => Semiring s
+ Data.Semiring: class Eq s => Semiring s
- Data.Semiring: fromBool :: (Semiring s) => Bool -> s
+ Data.Semiring: fromBool :: Semiring s => Bool -> s
- Data.Semiring: one :: (Semiring s) => s
+ Data.Semiring: one :: Semiring s => s
- Data.Semiring: zero :: (Semiring s) => s
+ Data.Semiring: zero :: Semiring s => s
- Data.Semiring.Properties: add'assoc :: (Semiring s) => s -> s -> s -> Bool
+ Data.Semiring.Properties: add'assoc :: Semiring s => s -> s -> s -> Bool
- Data.Semiring.Properties: left'ann :: (Semiring s) => s -> Bool
+ Data.Semiring.Properties: left'ann :: Semiring s => s -> Bool
- Data.Semiring.Properties: left'distr :: (Semiring s) => s -> s -> s -> Bool
+ Data.Semiring.Properties: left'distr :: Semiring s => s -> s -> s -> Bool
- Data.Semiring.Properties: left'one :: (Semiring s) => s -> Bool
+ Data.Semiring.Properties: left'one :: Semiring s => s -> Bool
- Data.Semiring.Properties: left'zero :: (Semiring s) => s -> Bool
+ Data.Semiring.Properties: left'zero :: Semiring s => s -> Bool
- Data.Semiring.Properties: mul'assoc :: (Semiring s) => s -> s -> s -> Bool
+ Data.Semiring.Properties: mul'assoc :: Semiring s => s -> s -> s -> Bool
- Data.Semiring.Properties: plus'comm :: (Semiring s) => s -> s -> Bool
+ Data.Semiring.Properties: plus'comm :: Semiring s => s -> s -> Bool
- Data.Semiring.Properties: right'ann :: (Semiring s) => s -> Bool
+ Data.Semiring.Properties: right'ann :: Semiring s => s -> Bool
- Data.Semiring.Properties: right'distr :: (Semiring s) => s -> s -> s -> Bool
+ Data.Semiring.Properties: right'distr :: Semiring s => s -> s -> s -> Bool
- Data.Semiring.Properties: right'one :: (Semiring s) => s -> Bool
+ Data.Semiring.Properties: right'one :: Semiring s => s -> Bool
- Text.RegExp: class (Semiring w) => Weight a b w
+ Text.RegExp: class Semiring w => Weight a b w
- Text.RegExp: fullMatch :: (Weight a b w) => RegExp a -> [b] -> w
+ Text.RegExp: fullMatch :: Weight a b w => RegExp a -> [b] -> w
- Text.RegExp: matchingCount :: (Num a) => RegExp c -> [c] -> a
+ Text.RegExp: matchingCount :: Num a => RegExp c -> [c] -> a
- Text.RegExp: partialMatch :: (Weight a b w) => RegExp a -> [b] -> w
+ Text.RegExp: partialMatch :: Weight a b w => RegExp a -> [b] -> w
- Text.RegExp: symWeight :: (Weight a b w) => (a -> w) -> b -> w
+ Text.RegExp: symWeight :: Weight a b w => (a -> w) -> b -> w

Files

CHANGES.markdown view
@@ -1,5 +1,31 @@-% Changelog for `weighted-regexp`+% Changelog for [`weighted-regexp`] +[`weighted-regexp`]: http://hackage.haskell.org/package/weighted-regexp++# 0.3.0.1++Moved build dependencies for QuickCheck and Criterion test programs+under a conditional so they are only pulled in if one actually+compiles these programs using the flags `-fQuickCheck` or+`-fCriterion`. (Thank you Brent!)++# 0.3.0.0++## Implemented workaround for [GHC ticket 4227]++Currently, GHC can SPECIALIZE functions only where they are defined.+The types `Leftmost`, `Longest`, and `LeftLong` are now defined in+separate modules to bring them into the scope of the matching+functions. Specialization makes the matching functions almost three+times faster for the types mentioned above.++This workaround allows to specialize the matching functions for types+defined in this package. Users, however, must use the matching+functions unspecialized for their own types.++Along with this change, the constructors of the matching types are no+longer exported.+ # 0.2.0.0  ## More general types for matching functions@@ -29,20 +55,22 @@ ## Strict numeric semiring  The lazy definition of arithmetic operations for the `Numeric`-semiring has been dropped in favour of the more efficient-standard implementation. As a consequence, `matchingCount` no-longer works with infinite regular expressions.+semiring has been dropped in favour of the more efficient standard+implementation. As a consequence, `matchingCount` no longer works with+infinite regular expressions.  ## SPECIALIZE pragmas prevent memory leak -The generalization of the matching functions leads to a memory-leak that can be avoided by specializing them for concrete-semirings. Corresponding pragmas have been added for `Bool` and-for `Numeric` types but not for the more complex semirings defined-in the extra matching modules. It is unclear what is the best way-to specialize them too because the pragma must be placed in the-module where the matching functions are defined but, there, not-all semirings are in scope.+The generalization of the matching functions leads to a memory leak+that can be avoided by specializing them for concrete+semirings. Corresponding pragmas have been added for `Bool` and for+`Numeric` types but not for the more complex semirings defined in the+extra matching modules. It is unclear what is the best way to+specialize them too because the pragma must be placed in the module+where the matching functions are defined but, there, not all semirings+are in scope. See [GHC ticket 4227].++[GHC ticket 4227]: http://hackage.haskell.org/trac/ghc/ticket/4227  ## Fixed mistake in Criterion benchmarks 
README.markdown view
@@ -52,9 +52,11 @@  </td><td> -You can install the `weighted-regexp` library by typing the following+You can install the [`weighted-regexp`] library by typing the following into a terminal: +[`weighted-regexp`]: http://hackage.haskell.org/package/weighted-regexp+     bash# cabal update     bash# cabal install weighted-regexp @@ -169,8 +171,7 @@ fast in this example, in fact, faster than re2[^cpp].   [^cpp]: The following C++ program uses the [re2] library and needs-*4.5s* to match `.*a.{20}a.*` against a string of ~2M random a's ad-b's:+*4s* to search for `a.{20}a` in a string of ~2M random a's ad b's:      <script src="http://gist.github.com/488543.js?file=re2.cpp"></script> @@ -208,20 +209,20 @@         matching  acceptance  #matchings  leftmost     longest  leftmost longest --------------- ----------- ----------- ---------- ---------- ------------------ unique full       [4.0 us]   [4.6 us]- ambiguous full   [11.7 us]   [13.1 us]- partial          [21.2 us]              [74.2 us]  [68.0 us]         [73.8 us]+ unique full       [3.8 us]   [4.8 us]+ ambiguous full   [11.7 us]   [13.4 us]+ partial          [20.4 us]              [27.2 us]  [26.2 us]         [27.5 us]  Click on the numbers for a more detailed distribution of run times. -[4.0 us]:  http://sebfisch.github.com/haskell-regexp/criterion/full-accept-phone-densities-800x600.png-[4.6 us]: http://sebfisch.github.com/haskell-regexp/criterion/full-count-phone-densities-800x600.png+[3.8 us]:  http://sebfisch.github.com/haskell-regexp/criterion/full-accept-phone-densities-800x600.png+[4.8 us]: http://sebfisch.github.com/haskell-regexp/criterion/full-count-phone-densities-800x600.png [11.7 us]: http://sebfisch.github.com/haskell-regexp/criterion/full-accept-html-densities-800x600.png-[13.1 us]: http://sebfisch.github.com/haskell-regexp/criterion/full-count-html-densities-800x600.png-[21.2 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-accept-rna-densities-800x600.png-[74.2 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-leftmost-rna-densities-800x600.png-[68.0 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-longest-rna-densities-800x600.png-[73.8 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-leftlong-rna-densities-800x600.png+[13.4 us]: http://sebfisch.github.com/haskell-regexp/criterion/full-count-html-densities-800x600.png+[20.4 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-accept-rna-densities-800x600.png+[27.2 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-leftmost-rna-densities-800x600.png+[26.2 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-longest-rna-densities-800x600.png+[27.5 us]: http://sebfisch.github.com/haskell-regexp/criterion/partial-leftlong-rna-densities-800x600.png  # Collaboration 
src/Text/RegExp/Matching/Longest.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}- -- | -- Module      : Text.RegExp.Matching.Longest -- Copyright   : Thomas Wilke, Frank Huch, and Sebastian Fischer
src/Text/RegExp/Matching/Longest/Type.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}+ module Text.RegExp.Matching.Longest.Type where  import Data.Semiring
weighted-regexp.cabal view
@@ -1,5 +1,5 @@ Name:          weighted-regexp-Version:       0.3.0.0+Version:       0.3.0.1 Cabal-Version: >= 1.6 Synopsis:      Weighted Regular Expression Matcher Description:@@ -49,7 +49,10 @@  Executable quickcheck-re   Main-Is:              quickcheck.lhs-  Build-Depends:        base >= 3 && < 5, QuickCheck < 2+  If flag(QuickCheck)+    Build-Depends:      base >= 3 && < 5, QuickCheck < 2+  Else+    Buildable:          False   HS-Source-Dirs:       src   Other-Modules:        Text.RegExp,                         Text.RegExp.Matching.Leftmost,@@ -72,8 +75,6 @@                         OverloadedStrings,                         ScopedTypeVariables   GHC-Options:          -fhpc -fno-warn-missing-methods -fno-warn-orphans-  If !flag(QuickCheck)-    Buildable:          False  Flag Criterion   Description:          Build executable to run Criterion benchmarks@@ -81,7 +82,10 @@  Executable criterion-re   Main-Is:              criterion.lhs-  Build-Depends:        base >= 3 && < 5, criterion >= 0.5 && < 0.6+  If flag(Criterion)+    Build-Depends:      base >= 3 && < 5, criterion >= 0.5 && < 0.6+  Else+    Buildable:          False   HS-Source-Dirs:       src   Other-Modules:        Text.RegExp,                         Text.RegExp.Matching.Leftmost,@@ -102,8 +106,6 @@                         GeneralizedNewtypeDeriving,                         OverloadedStrings   GHC-Options:          -  If !flag(Criterion)-    Buildable:          False  Source-Repository head   type:     git