Skip to content

Commit

Permalink
Merge pull request #161 from iconnect/i160
Browse files Browse the repository at this point in the history
1.0.1.4: fix for GHC-8.4.4 and GHC-8.6.2
  • Loading branch information
cdornan committed Dec 14, 2018
2 parents 4771110 + 661da40 commit 2fc392d
Show file tree
Hide file tree
Showing 28 changed files with 645 additions and 621 deletions.
22 changes: 7 additions & 15 deletions .travis.yml
Expand Up @@ -46,25 +46,17 @@ matrix:
compiler: ": #stack 7.10.3"
addons: {apt: {packages: [libgmp-dev]}}

- env: BUILD=stack GHCVER=7.8.4 STACK_YAML=stack-7.8.yaml
compiler: ": #stack 7.8.4"
addons: {apt: {packages: [libgmp-dev]}}

- env: BUILD=stack GHCVER=8.0.2 STACK_YAML=stack-8.0.yaml
compiler: ": #stack 8.0.2"
addons: {apt: {packages: [libgmp-dev]}}

# Linux/cabal

- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC 7.10.3"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC 7.8.4"
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC 8.0.2"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=stack GHCVER=8.4.4 STACK_YAML=stack-8.4.yaml
compiler: ": #stack 8.4.4"
addons: {apt: {packages: [libgmp-dev]}}

- env: BUILD=stack GHCVER=8.6.2 STACK_YAML=stack-8.4.yaml
compiler: ": #stack 8.6.2"
addons: {apt: {packages: [libgmp-dev]}}


# macOS (stack)
Expand Down
1 change: 1 addition & 0 deletions Text/RE/ZeInternals/Replace.lhs
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MonoLocalBinds #-}
module Text.RE.ZeInternals.Replace
(
Expand Down
1 change: 1 addition & 0 deletions Text/RE/ZeInternals/Types/Match.lhs
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MonoLocalBinds #-}
\end{code}

\begin{code}
Expand Down
1 change: 1 addition & 0 deletions Text/RE/ZeInternals/Types/Matches.lhs
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MonoLocalBinds #-}
\end{code}

\begin{code}
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Expand Up @@ -17,7 +17,8 @@ environment:
STACK_ROOT: "c:\\sr"

test_script:
- cp lib/regex.cabal .
- stack setup > nul
# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor
- echo "" | stack --no-terminal --stack-yaml stack-8.0.yaml test
- echo "" | stack --no-terminal --stack-yaml stack-8.4.yaml build regex:lib
3 changes: 3 additions & 0 deletions changelog
@@ -1,5 +1,8 @@
-*-change-log-*-

1.0.1.4 Chris Dornan <chris.dornan@irisconnect.co.uk> 2018-12-14
* GHC-8.4.4, GHC-8.6.2 (#160)

1.0.1.3 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-06-05
* Suspending UTF-8 tests for Windows/PCRE (#144)

Expand Down
3 changes: 2 additions & 1 deletion examples/TestKit.lhs
Expand Up @@ -42,6 +42,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS
import qualified Data.List as L
import Data.Maybe
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Prelude.Compat
import qualified Shelly as SH
import System.Directory
Expand Down Expand Up @@ -109,7 +110,7 @@ substVersion_ txt =
ms = txt *=~ [re|<<\$version\$>>|]
readCurrentVersion :: IO Vrn
readCurrentVersion = parseVrn <$> readFile "lib/version.txt"
readCurrentVersion = parseVrn . T.unpack <$> T.readFile "lib/version.txt"
write_current_version :: Vrn -> IO ()
write_current_version = writeFile "lib/version.txt" . presentVrn
Expand Down
80 changes: 40 additions & 40 deletions examples/re-tests.lhs
Expand Up @@ -368,18 +368,18 @@ search_replace_tests :: TestTree
search_replace_tests = testGroup "SearchReplace" $
[ testCase "?=~/ [ed_| ... |]" $ "baz bar foobar" @=? "foo bar foobar" T_ST.?=~/ [ed_|foo///baz|] ()
, testCase "*=~/ [ed_| ... |]" $ "baz bar bazbar" @=? "foo bar foobar" T_ST.*=~/ [ed_|foo///baz|] MultilineSensitive
, testCase "TDFA.ed/String" $ test id tdfa_eds
, testCase "PCRE.ed/String" $ test id pcre_eds
, testCase "TDFA.ed/B" $ test B.pack tdfa_eds
, testCase "PCRE.ed/B" $ test B.pack pcre_eds
, testCase "TDFA.ed/LBS" $ test LBS.pack tdfa_eds
, testCase "PCRE.ed/LBS" $ test LBS.pack pcre_eds
, testCase "TDFA.ed/S" $ test S.fromList tdfa_eds
, testCase "PCRE.ed/S" $ test S.fromList pcre_eds
, testCase "TDFA.ed/T" $ test T.pack tdfa_eds
, testCase "TDFA.ed/LT" $ test LT.pack tdfa_eds
, testCase "TDFA.ed/T(d)" $ test T.pack tdfa_eds'
, testCase "PCRE.ed/LBS(d)" $ test LBS.pack pcre_eds'
, testCase "TDFA.ed/String" $ test_ id tdfa_eds
, testCase "PCRE.ed/String" $ test_ id pcre_eds
, testCase "TDFA.ed/B" $ test_ B.pack tdfa_eds
, testCase "PCRE.ed/B" $ test_ B.pack pcre_eds
, testCase "TDFA.ed/LBS" $ test_ LBS.pack tdfa_eds
, testCase "PCRE.ed/LBS" $ test_ LBS.pack pcre_eds
, testCase "TDFA.ed/S" $ test_ S.fromList tdfa_eds
, testCase "PCRE.ed/S" $ test_ S.fromList pcre_eds
, testCase "TDFA.ed/T" $ test_ T.pack tdfa_eds
, testCase "TDFA.ed/LT" $ test_ LT.pack tdfa_eds
, testCase "TDFA.ed/T(d)" $ test_ T.pack tdfa_eds'
, testCase "PCRE.ed/LBS(d)" $ test_ LBS.pack pcre_eds'
, testg "TDFA.op" (T_ST.?=~/) (T_ST.*=~/) tdfa_sr
, testg "PCRE.op" (P_ST.?=~/) (P_ST.*=~/) pcre_sr
, testg "TDFA.op/String" (T_ST.?=~/) (T_ST.*=~/) tdfa_sr_str
Expand Down Expand Up @@ -414,8 +414,8 @@ search_replace_tests = testGroup "SearchReplace" $
True -> const []
False -> id
test :: IsRegex re a => (String->a) -> Edits Identity re a -> Assertion
test inj eds = inj rsm @=? runIdentity (sed' eds $ inj inp)
test_ :: IsRegex re a => (String->a) -> Edits Identity re a -> Assertion
test_ inj eds = inj rsm @=? runIdentity (sed' eds $ inj inp)
testg lab op1 opm sr = testGroup lab
[ testCase "?=~/" $ rs1 @=? inp `op1` sr
Expand Down Expand Up @@ -549,34 +549,34 @@ options_tests = testGroup "Simple REOptions"
\begin{code}
many_tests :: TestTree
many_tests = testGroup "Many Tests"
[ testCase "PCRE a" $ test (PCRE.*=~) (PCRE.?=~) (PCRE.=~) (PCRE.=~~) matchOnce matchMany makeSearchReplace id re_pcre
, testCase "PCRE ByteString" $ test (P_BS.*=~) (P_BS.?=~) (P_BS.=~) (P_BS.=~~) matchOnce matchMany makeSearchReplace B.pack re_pcre
, testCase "PCRE ByteString.Lazy" $ test (PLBS.*=~) (PLBS.?=~) (PLBS.=~) (PLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack re_pcre
, testCase "PCRE Sequence" $ test (P_SQ.*=~) (P_SQ.?=~) (P_SQ.=~) (P_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList re_pcre
, testCase "PCRE String" $ test (P_ST.*=~) (P_ST.?=~) (P_ST.=~) (P_ST.=~~) matchOnce matchMany makeSearchReplace id re_pcre
, testCase "PCRE Text" $ test (P_TX.*=~) (P_TX.?=~) (P_TX.=~) (P_TX.=~~) matchOnce matchMany makeSearchReplace T.pack re_pcre
, testCase "PCRE Text.Lazy" $ test (PLTX.*=~) (PLTX.?=~) (PLTX.=~) (PLTX.=~~) matchOnce matchMany makeSearchReplace LT.pack re_pcre
, testCase "TDFA a" $ test (TDFA.*=~) (TDFA.?=~) (TDFA.=~) (TDFA.=~~) matchOnce matchMany makeSearchReplace id re_tdfa
, testCase "TDFA ByteString" $ test (T_BS.*=~) (T_BS.?=~) (T_BS.=~) (T_BS.=~~) matchOnce matchMany makeSearchReplace B.pack re_tdfa
, testCase "TDFA ByteString.Lazy" $ test (TLBS.*=~) (TLBS.?=~) (TLBS.=~) (TLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack re_tdfa
, testCase "TDFA Sequence" $ test (T_SQ.*=~) (T_SQ.?=~) (T_SQ.=~) (T_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList re_tdfa
, testCase "TDFA String" $ test (T_ST.*=~) (T_ST.?=~) (T_ST.=~) (T_ST.=~~) matchOnce matchMany makeSearchReplace id re_tdfa
, testCase "TDFA Text" $ test (T_TX.*=~) (T_TX.?=~) (T_TX.=~) (T_TX.=~~) matchOnce matchMany makeSearchReplace T.pack re_tdfa
, testCase "TDFA Text.Lazy" $ test (TLTX.*=~) (TLTX.?=~) (TLTX.=~) (TLTX.=~~) matchOnce matchMany makeSearchReplace LT.pack re_tdfa
[ testCase "PCRE a" $ test_ (PCRE.*=~) (PCRE.?=~) (PCRE.=~) (PCRE.=~~) matchOnce matchMany makeSearchReplace id re_pcre
, testCase "PCRE ByteString" $ test_ (P_BS.*=~) (P_BS.?=~) (P_BS.=~) (P_BS.=~~) matchOnce matchMany makeSearchReplace B.pack re_pcre
, testCase "PCRE ByteString.Lazy" $ test_ (PLBS.*=~) (PLBS.?=~) (PLBS.=~) (PLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack re_pcre
, testCase "PCRE Sequence" $ test_ (P_SQ.*=~) (P_SQ.?=~) (P_SQ.=~) (P_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList re_pcre
, testCase "PCRE String" $ test_ (P_ST.*=~) (P_ST.?=~) (P_ST.=~) (P_ST.=~~) matchOnce matchMany makeSearchReplace id re_pcre
, testCase "PCRE Text" $ test_ (P_TX.*=~) (P_TX.?=~) (P_TX.=~) (P_TX.=~~) matchOnce matchMany makeSearchReplace T.pack re_pcre
, testCase "PCRE Text.Lazy" $ test_ (PLTX.*=~) (PLTX.?=~) (PLTX.=~) (PLTX.=~~) matchOnce matchMany makeSearchReplace LT.pack re_pcre
, testCase "TDFA a" $ test_ (TDFA.*=~) (TDFA.?=~) (TDFA.=~) (TDFA.=~~) matchOnce matchMany makeSearchReplace id re_tdfa
, testCase "TDFA ByteString" $ test_ (T_BS.*=~) (T_BS.?=~) (T_BS.=~) (T_BS.=~~) matchOnce matchMany makeSearchReplace B.pack re_tdfa
, testCase "TDFA ByteString.Lazy" $ test_ (TLBS.*=~) (TLBS.?=~) (TLBS.=~) (TLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack re_tdfa
, testCase "TDFA Sequence" $ test_ (T_SQ.*=~) (T_SQ.?=~) (T_SQ.=~) (T_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList re_tdfa
, testCase "TDFA String" $ test_ (T_ST.*=~) (T_ST.?=~) (T_ST.=~) (T_ST.=~~) matchOnce matchMany makeSearchReplace id re_tdfa
, testCase "TDFA Text" $ test_ (T_TX.*=~) (T_TX.?=~) (T_TX.=~) (T_TX.=~~) matchOnce matchMany makeSearchReplace T.pack re_tdfa
, testCase "TDFA Text.Lazy" $ test_ (TLTX.*=~) (TLTX.?=~) (TLTX.=~) (TLTX.=~~) matchOnce matchMany makeSearchReplace LT.pack re_tdfa
]
where
test :: (IsRegex r s,Show s,Eq s)
=> (s->r->Matches s)
-> (s->r->Match s)
-> (s->r->Matches s)
-> (s->r->Maybe(Match s))
-> (r->s->Match s)
-> (r->s->Matches s)
-> (s->s->Either String (SearchReplace r s))
-> (String->s)
-> r
-> Assertion
test (%*=~) (%?=~) (%=~) (%=~~) mo mm mk_sr0 inj r = do
test_ :: (IsRegex r s,Show s,Eq s)
=> (s->r->Matches s)
-> (s->r->Match s)
-> (s->r->Matches s)
-> (s->r->Maybe(Match s))
-> (r->s->Match s)
-> (r->s->Matches s)
-> (s->s->Either String (SearchReplace r s))
-> (String->s)
-> r
-> Assertion
test_ (%*=~) (%?=~) (%=~) (%=~~) mo mm mk_sr0 inj r = do
2 @=? countMatches mtchs
Just txt' @=? matchedText mtch
mtchs @=? mtchs'
Expand Down
30 changes: 23 additions & 7 deletions examples/re-top.lhs
Expand Up @@ -11,6 +11,7 @@ repo](git@github.com:cdornan/eng-england.git) into the parent directory
and checkout the 'corrections' branch.

\begin{code}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -112,17 +113,32 @@ data Results =
These vectors have expected zeros and sums.

\begin{code}
#if __GLASGOW_HASKELL__ >= 804
instance Semigroup Results where
(<>) = mappend_r
#endif
instance Monoid Results where
mempty = Results 0 0 0 0 0
mappend (Results gp1 gw1 gf1 ga1 ps1)
mempty = mempty_r
mappend = mappend_r
\end{code}


\begin{code}
mappend_r :: Results -> Results -> Results
mappend_r (Results gp1 gw1 gf1 ga1 ps1)
(Results gp2 gw2 gf2 ga2 ps2) =
Results (gp1+gp2)
(gw1+gw2)
(gf1+gf2)
(ga1+ga2)
(ps1+ps2)
Results (gp1+gp2)
(gw1+gw2)
(gf1+gf2)
(ga1+ga2)
(ps1+ps2)
mempty_r :: Results
mempty_r = Results 0 0 0 0 0
\end{code}


PL results are ordered by (points,goal-difference,goals-scored).

\begin{code}
Expand Down
4 changes: 0 additions & 4 deletions examples/re-tutorial.lhs
Expand Up @@ -44,10 +44,6 @@ to answer two questions:
is for you, otherwise it is the PCRE back end, which is housed in
a seperate `regex-with-pcre` package.
2. Which Haskell type is being used for the text I need to match? This
can influence as, at the time of writing, the `PCRE` `regex` back end
[does not support the`Text` types](https://github.com/iconnect/regex/issues/58).
The import statement will in general look like this
```
import Text.RE.<back-end>.<text-type>
Expand Down
18 changes: 8 additions & 10 deletions lib/cabal-masters/constraints-incl.cabal
@@ -1,11 +1,9 @@
%- regex == <<$version$>>
%- regex-with-pcre == <<$version$>>
%- array >= 0.4 && < 0.6
%- base >= 4 && < 5
%- base-compat >= 0.6 && < 0.10
%- array >= 0.4
%- base >= 4 && < 5
%- base-compat >= 0.6
%- blaze-html >= 0.8.1.0
%- bytestring == 0.10.*
%- containers >= 0.4 && < 0.6
%- containers >= 0.4
%- data-default >= 0.5.3
%- directory >= 1.2.1.0
%- filepath >= 1.3.0.2
Expand All @@ -23,10 +21,10 @@
%- tasty >= 0.10.1.2
%- tasty-hunit >= 0.9.2
%- tasty-smallcheck >= 0.8.0.1
%- template-haskell >= 2.7 && < 2.12
%- template-haskell >= 2.7
%- text == 1.2.*
%- time >= 1.4.2 && < 1.9
%- time >= 1.4.2
%- time-locale-compat == 0.1.*
%- transformers >= 0.2.2 && < 0.6
%- transformers >= 0.2.2
%- unordered-containers == 0.2.*
%- utf8-string >= 1 && < 1.1
%- utf8-string >= 1
2 changes: 1 addition & 1 deletion lib/cabal-masters/executables-incl.cabal
Expand Up @@ -97,8 +97,8 @@
Other-Modules:
TestKit

Extensions: OverloadedStrings
Default-Extensions: QuasiQuotes
OverloadedStrings
%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers

%test-exe re-tutorial-options
Expand Down
2 changes: 1 addition & 1 deletion lib/cabal-masters/regex-incl.cabal
Expand Up @@ -19,7 +19,7 @@ Stability: Stable
bug-reports: http://issues.regex.uk

Extra-Source-Files:
README.markdown
README.md
changelog

Cabal-Version: >= 1.10
Expand Down
2 changes: 1 addition & 1 deletion lib/cabal-masters/test-extra-source-files-incl.cabal
@@ -1,5 +1,5 @@
Extra-Source-Files:
README.markdown
README.md
changelog
data/2015-16-premierleague.txt
data/access-errors.log
Expand Down
2 changes: 1 addition & 1 deletion lib/md/roadmap-incl.md
Expand Up @@ -3,4 +3,4 @@
- [X] 2017-06-04 v1.0.1.1 [Fix 1.0.1.0 release bug and provisionally fix UTF8/PCRE interworking](https://github.com/iconnect/regex/milestone/20)
- [X] 2017-06-05 v1.0.1.2 [Permit utf8-string-1](https://github.com/iconnect/regex/milestone/21)
- [X] 2017-06-05 v1.0.1.3 [Suspend Windows tests for PCRE on UTF-8 text](https://github.com/iconnect/regex/milestone/22)
- [ ] 2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4)
- [X] 2018-12-14 v1.0.1.4 [Fix for GHC 8.4.4, GHC-8.6.2](https://github.com/iconnect/regex/milestone/23)

0 comments on commit 2fc392d

Please sign in to comment.