case-insensitive 1.2.1.0 → 1.2.2.0
raw patch · 8 files changed
+114/−94 lines, 8 filesdep +tastydep +tasty-hunitdep +template-haskelldep −semigroupsdep −test-frameworkdep −test-framework-hunitdep ~basedep ~bytestringdep ~deepseqnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: tasty, tasty-hunit, template-haskell
Dependencies removed: semigroups, test-framework, test-framework-hunit
Dependency ranges changed: base, bytestring, deepseq, hashable, text
API changes (from Hackage documentation)
Files
- CHANGELOG +7/−0
- Data/CaseInsensitive.hs +3/−7
- Data/CaseInsensitive/Internal.hs +16/−14
- Data/CaseInsensitive/Unsafe.hs +1/−5
- README.markdown +1/−1
- bench/bench.hs +0/−6
- case-insensitive.cabal +74/−57
- test/test.hs +12/−4
CHANGELOG view
@@ -1,3 +1,10 @@+1.2.2.0++* Drop support for old GHC versions (support GHC 9.2+, MHS)+* Add `Lift` instance to `CI`+* Add `FoldCase` instance for `ShortByteString`+* Tighten dependency bounds.+ 1.2.1.0 * Add traverse
Data/CaseInsensitive.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP, NoImplicitPrelude #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE NoImplicitPrelude, Trustworthy #-} ----------------------------------------------------------------------------- -- |@@ -27,8 +23,8 @@ , mk , original , foldedCase- , map- , traverse+ , Data.CaseInsensitive.Internal.map+ , Data.CaseInsensitive.Internal.traverse , FoldCase(foldCase) ) where import Data.CaseInsensitive.Internal
Data/CaseInsensitive/Internal.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP, DeriveDataTypeable #-}--#if __GLASGOW_HASKELL__ >= 704-{-# LANGUAGE Unsafe #-}-#endif+{-# LANGUAGE DeriveDataTypeable, TemplateHaskell, DeriveLift, Unsafe, CPP #-} ----------------------------------------------------------------------------- -- |@@ -36,11 +32,10 @@ import Data.Char ( Char, toLower ) import Data.Eq ( Eq, (==) ) import Data.Function ( on )-import Data.Monoid ( Monoid, mempty, mappend )+import Data.Monoid ( Monoid, mempty ) import Data.Ord ( Ord, compare ) import Data.String ( IsString, fromString ) import Data.Data ( Data )-import Data.Typeable ( Typeable ) import Data.Word ( Word8 ) import Prelude ( (.), fmap, (&&), (+), (<=), otherwise ) import Text.Read ( Read, readPrec )@@ -49,14 +44,10 @@ import qualified Data.List as L ( map ) -#if __GLASGOW_HASKELL__ < 700-import Control.Monad ( (>>) )-import Prelude ( fromInteger )-#endif- -- from bytestring: import qualified Data.ByteString as B ( ByteString, map ) import qualified Data.ByteString.Lazy as BL ( ByteString, map )+import qualified Data.ByteString.Short as BS ( ShortByteString, map ) -- from text: import qualified Data.Text as T ( Text, toCaseFold )@@ -68,6 +59,10 @@ -- from hashable: import Data.Hashable ( Hashable, hashWithSalt ) +#ifdef __GLASGOW_HASKELL__+-- from template-haskell:+import Language.Haskell.TH.Syntax ( Lift )+#endif -------------------------------------------------------------------------------- -- Case Insensitive Strings@@ -90,7 +85,12 @@ , foldedCase :: !s -- ^ Retrieve the case folded string-like value. -- (Also see 'foldCase'). }- deriving (Data, Typeable)+ deriving+ ( Data+#ifdef __GLASGOW_HASKELL__+ , Lift+#endif+ ) -- | Make the given string-like value case insensitive. mk :: FoldCase s => s -> CI s@@ -121,7 +121,6 @@ instance Monoid s => Monoid (CI s) where mempty = CI mempty mempty- CI o1 l1 `mappend` CI o2 l2 = CI (o1 `mappend` o2) (l1 `mappend` l2) instance Eq s => Eq (CI s) where (==) = (==) `on` foldedCase@@ -166,6 +165,9 @@ -- | Note that @foldCase@ on @'BL.ByteString's@ is only guaranteed to be correct for ISO-8859-1 encoded strings! instance FoldCase BL.ByteString where foldCase = BL.map toLower8++-- | Note that @foldCase@ on @'BL.ByteString's@ is only guaranteed to be correct for ISO-8859-1 encoded strings!+instance FoldCase BS.ShortByteString where foldCase = BS.map toLower8 instance FoldCase Char where foldCase = toLower
Data/CaseInsensitive/Unsafe.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP, NoImplicitPrelude #-}--#if __GLASGOW_HASKELL__ >= 704-{-# LANGUAGE Unsafe #-}-#endif+{-# LANGUAGE NoImplicitPrelude, Unsafe #-} ----------------------------------------------------------------------------- -- |
README.markdown view
@@ -1,5 +1,5 @@ [](https://hackage.haskell.org/package/case-insensitive)-[](https://travis-ci.org/basvandijk/case-insensitive)+[](https://github.com/basvandijk/case-insensitive/actions/workflows/main.yml) The module `Data.CaseInsensitive` provides the `CI` type constructor which can be parameterised by a string-like type like: `String`,
bench/bench.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Main ( main) where@@ -7,11 +6,6 @@ import qualified Data.ByteString as B ( readFile ) import qualified Data.CaseInsensitive as CI ( mk ) import qualified NoClass as NC ( mk )--#if !MIN_VERSION_bytestring(0,10,0)-import Control.DeepSeq ( NFData )-instance NFData ByteString-#endif main :: IO () main = do
case-insensitive.cabal view
@@ -1,73 +1,90 @@-name: case-insensitive-version: 1.2.1.0-cabal-version: >=1.8-build-type: Simple-license: BSD3-license-file: LICENSE-copyright: 2011 Bas van Dijk-author: Bas van Dijk-maintainer: Bas van Dijk <v.dijk.bas@gmail.com>-homepage: https://github.com/basvandijk/case-insensitive-bug-reports: https://github.com/basvandijk/case-insensitive/issues-category: Data, Text-synopsis: Case insensitive string comparison-description: The module @Data.CaseInsensitive@ provides the 'CI' type- constructor which can be parameterised by a string-like- type like: 'String', 'ByteString', 'Text',- etc.. Comparisons of values of the resulting type will be- insensitive to cases.+cabal-version: 3.0+name: case-insensitive+version: 1.2.2.0+build-type: Simple+license: BSD-3-Clause+license-file: LICENSE+copyright: 2011 Bas van Dijk+author: Bas van Dijk+maintainer: Bas van Dijk <v.dijk.bas@gmail.com>+homepage: https://github.com/basvandijk/case-insensitive+bug-reports: https://github.com/basvandijk/case-insensitive/issues+category: Data, Text+synopsis: Case insensitive string comparison+description:+ The module @Data.CaseInsensitive@ provides the 'CI' type+ constructor which can be parameterised by a string-like+ type like: 'String', 'ByteString', 'Text',+ etc.. Comparisons of values of the resulting type will be+ insensitive to cases.+ tested-with:- GHC==7.0.4,- GHC==7.2.2- GHC==7.4.2,- GHC==7.6.3,- GHC==7.8.4,- GHC==7.10.3,- GHC==8.0.1+ ghc ==9.10+ ghc ==9.12+ ghc ==9.14+ ghc ==9.2+ ghc ==9.4+ ghc ==9.6+ ghc ==9.8 -extra-source-files: README.markdown CHANGELOG pg2189.txt+extra-doc-files:+ CHANGELOG+ README.markdown +extra-source-files:+ pg2189.txt+ source-repository head- Type: git- Location: git://github.com/basvandijk/case-insensitive.git+ type: git+ location: https://github.com/basvandijk/case-insensitive.git -Library+library+ default-language: Haskell2010 ghc-options: -Wall- build-depends: base >= 3 && < 5- , bytestring >= 0.9- , text >= 0.3- , deepseq >= 1.1- , hashable >= 1.0- if !impl(ghc >= 8.0)- build-depends: semigroups >= 0.18- exposed-modules: Data.CaseInsensitive, Data.CaseInsensitive.Unsafe+ build-depends:+ base >=4.16 && <5,+ bytestring >=0.11.3 && <0.13,+ deepseq >=1.4.6 && <1.6,+ hashable >=1.4.0.1 && <1.6,+ text >=2.0 && <2.2,++ if impl(ghc)+ build-depends: template-haskell >=2.2 && <3+ exposed-modules:+ Data.CaseInsensitive+ Data.CaseInsensitive.Unsafe+ other-modules: Data.CaseInsensitive.Internal test-suite test-case-insensitive- type: exitcode-stdio-1.0- main-is: test.hs+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: test.hs hs-source-dirs: test-- build-depends: case-insensitive- , base >= 3 && < 5- , bytestring >= 0.9- , text >= 0.3- , HUnit >= 1.2.2- , test-framework >= 0.2.4- , test-framework-hunit >= 0.2.4+ build-depends:+ base >=3 && <5,+ bytestring >=0.9,+ case-insensitive,+ HUnit >=1.2.2,+ tasty ^>=1.5,+ tasty-hunit ^>=0.10,+ template-haskell >=2.2,+ text >=0.3, ghc-options: -Wall benchmark bench-case-insensitive- type: exitcode-stdio-1.0- main-is: bench.hs- other-modules: NoClass+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: bench.hs+ other-modules: NoClass hs-source-dirs: bench-- ghc-options: -Wall -O2+ ghc-options:+ -Wall - build-depends: case-insensitive- , base >= 3 && < 5- , bytestring >= 0.9- , criterion >= 0.6.1- , deepseq >= 1.1+ build-depends:+ base >=3 && <5,+ bytestring >=0.9,+ case-insensitive,+ criterion >=0.6.1,+ deepseq >=1.1,
test/test.hs view
@@ -1,6 +1,8 @@+{-# LANGUAGE TemplateHaskell #-} module Main ( main ) where import Data.ByteString ( ByteString )+import Data.ByteString.Short ( toShort ) import qualified Data.ByteString.Char8 as BC8 ( pack, map ) import qualified Data.ByteString.Lazy as Lazy ( ByteString ) import qualified Data.ByteString.Lazy.Char8 as BLC8 ( pack, map )@@ -10,12 +12,12 @@ import qualified Data.Text as T ( pack, toUpper ) import qualified Data.Text.Lazy as Lazy ( Text ) import qualified Data.Text.Lazy as TL ( pack, toUpper )-import Test.Framework ( defaultMain, testGroup )-import Test.Framework.Providers.HUnit ( testCase )-import Test.HUnit ( assertEqual )+import Test.Tasty+import Test.Tasty.HUnit+import Language.Haskell.TH.Syntax ( lift ) main :: IO ()-main = defaultMain+main = defaultMain $ testGroup "case-insensitive" [ testGroup "ASCII" [ testCase "String" $ assertEqual "" (CI.mk asciiStr) (CI.mk ( map toUpper asciiStr))@@ -23,6 +25,8 @@ (CI.mk ( BC8.map toUpper asciiBs)) , testCase "Lazy.ByteString" $ assertEqual "" (CI.mk asciiLBs) (CI.mk (BLC8.map toUpper asciiLBs))+ , testCase "ShortByteString" $ assertEqual "" (CI.mk (toShort asciiBs))+ (CI.mk (toShort (BC8.map toUpper asciiBs))) , testCase "Text" $ assertEqual "" (CI.mk asciiTxt) (CI.mk ( T.toUpper asciiTxt)) , testCase "Lazy.Text" $ assertEqual "" (CI.mk asciiLTxt)@@ -39,6 +43,10 @@ (CI.mk ( T.toUpper iso_8859_1Txt)) , testCase "Lazy.Text" $ assertEqual "" (CI.mk iso_8859_1LTxt) (CI.mk ( TL.toUpper iso_8859_1LTxt))+ ]+ , testGroup "Lift Instance"+ [ testCase "String" $ assertEqual "" $(lift $ CI.mk "aBc")+ (CI.mk "abc") ] ]