regex-applicative 0.3.0.3 → 0.3.1
raw patch · 4 files changed
+22/−51 lines, 4 files
Files
- CHANGES.md +5/−0
- Text/Regex/Applicative.hs +1/−0
- Text/Regex/Applicative/Interface.hs +15/−0
- regex-applicative.cabal +1/−51
CHANGES.md view
@@ -1,6 +1,11 @@ Changes ======= +0.3.1+-----++Add `comap`+ 0.3.0.3 -------
Text/Regex/Applicative.hs view
@@ -20,6 +20,7 @@ , reFoldl , Greediness(..) , few+ , comap , withMatched , match , (=~)
Text/Regex/Applicative/Interface.hs view
@@ -29,6 +29,21 @@ instance (char ~ Char, string ~ String) => IsString (RE char string) where fromString = string +-- | 'RE' is a profunctor. This is its contravariant map.+--+-- (A dependency on the @profunctors@ package doesn't seem justified.)+comap :: (s2 -> s1) -> RE s1 a -> RE s2 a+comap f re =+ case re of+ Eps -> Eps+ Symbol t p -> Fmap f $ Symbol t (p . f)+ Alt r1 r2 -> Alt (comap f r1) (comap f r2)+ App r1 r2 -> App (comap f r1) (comap f r2)+ Fmap g r -> Fmap g (comap f r)+ Fail -> Fail+ Rep gr fn a r -> Rep gr fn a (comap f r)+ Void r -> Void (comap f r)+ -- | Match and return a single symbol which satisfies the predicate psym :: (s -> Bool) -> RE s s psym p = Symbol (error "Not numbered symbol") p
regex-applicative.cabal view
@@ -1,86 +1,36 @@--- regex-applicative.cabal auto-generated by cabal init. For--- additional options, see--- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.--- The name of the package. Name: regex-applicative---- The package version. See the Haskell package versioning policy--- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for--- standards guiding when and how versions should be incremented.---- DO NOT FORGET TO UPDATE THE GIT TAG BELOW!!!-Version: 0.3.0.3---- A short (one-line) description of the package.+Version: 0.3.1 Synopsis: Regex-based parsing with applicative interface---- A longer description of the package. Description: regex-applicative is a Haskell library for parsing using regular expressions. Parsers can be built using Applicative interface.---- URL for the project homepage or repository. Homepage: https://github.com/feuerbach/regex-applicative---- The license under which the package is released. License: MIT---- The file containing the license text. License-file: LICENSE---- The package author(s). Author: Roman Cheplyaka---- An email address to which users can send suggestions, bug reports,--- and patches. Maintainer: Roman Cheplyaka <roma@ro-che.info>---- A copyright notice.--- Copyright: - Category: Text- Build-type: Simple---- Extra files to be distributed with the package, such as examples or--- a README. Extra-source-files: README.md CREDITS.md CHANGES.md---- Constraint on the version of Cabal needed to build this package. Cabal-version: >=1.10 Source-repository head type: git location: git://github.com/feuerbach/regex-applicative.git -Source-repository this- type: git- location: git://github.com/feuerbach/regex-applicative.git- tag: v0.3.0.3- Library Default-language: Haskell2010- -- Packages needed in order to build this package. Build-depends: base < 5, containers, transformers--- -- Modules exported by the library. Exposed-modules: Text.Regex.Applicative Text.Regex.Applicative.Object Text.Regex.Applicative.Common Text.Regex.Applicative.Reference- - -- Modules not exported by this package. Other-modules: Text.Regex.Applicative.Interface Text.Regex.Applicative.Types Text.Regex.Applicative.Compile Text.Regex.Applicative.StateQueue- - -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.- -- Build-tools: - GHC-Options: -O2 -Wall -fno-warn-name-shadowing