packages feed

cassava 0.5.3.0 → 0.5.3.1

raw patch · 9 files changed

+57/−157 lines, 9 filesdep −bytestring-builderdep −faildep −ghc-primdep ~QuickCheckdep ~basedep ~bytestringPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: bytestring-builder, fail, ghc-prim, nats, semigroups

Dependency ranges changed: QuickCheck, base, bytestring

API changes (from Hackage documentation)

- Data.Csv: newtype Only a
+ Data.Csv: newtype () => Only a

Files

CHANGES.md view
@@ -1,3 +1,19 @@+## Version 0.5.3.1++ * Remove support for GHC 7.+ * Remove cabal flag `bytestring--LT-0_10_4` and support for `bytestring < 0.10.4`.+ * Tested with GHC 8.0 - 9.10 alpha3++## Version 0.5.3.0 revision 2++ * Allow `bytestring-0.12`+ * Tested with GHC 7.4 - 9.6.2++## Version 0.5.3.0 revision 1++ * Allow `base-4.18`+ * Tested with GHC 7.4 - 9.6.1 alpha+ ## Version 0.5.3.0   * Improve error messages for `lookup` and NamedRecord parsers (#197)
cassava.cabal view
@@ -1,6 +1,6 @@ cabal-version:       1.12 Name:                cassava-Version:             0.5.3.0+Version:             0.5.3.1 Synopsis:            A CSV parsing and encoding library Description: { @@ -43,8 +43,11 @@                      CHANGES.md,                      README.md Tested-with:-  GHC == 9.4.1-  GHC == 9.2.3+  GHC == 9.10.0+  GHC == 9.8.2+  GHC == 9.6.5+  GHC == 9.4.8+  GHC == 9.2.8   GHC == 9.0.2   GHC == 8.10.7   GHC == 8.8.4@@ -52,10 +55,6 @@   GHC == 8.4.4   GHC == 8.2.2   GHC == 8.0.2-  GHC == 7.10.3-  GHC == 7.8.4-  GHC == 7.6.3-  GHC == 7.4.2  ---------------------------------------------------------------------------- @@ -63,17 +62,13 @@   type:     git   location: https://github.com/haskell-hvr/cassava.git -flag bytestring--LT-0_10_4-  description: [bytestring](https://hackage.haskell.org/haskell/package/bytestring) < 0.10.4-  default: False-  manual:  False- Library   default-language: Haskell2010   other-extensions:     BangPatterns     CPP     DataKinds+    DataKinds     DefaultSignatures     DeriveFunctor     FlexibleContexts@@ -82,16 +77,12 @@     MultiParamTypeClasses     OverloadedStrings     PolyKinds+    PolyKinds     Rank2Types     ScopedTypeVariables     TypeOperators     UndecidableInstances -  if impl(ghc >= 8.0)-    other-extensions:-      DataKinds-      PolyKinds-   hs-source-dirs: src    Exposed-modules:@@ -109,51 +100,35 @@     Data.Csv.Util    Build-depends:-      base         >= 4.5      && < 4.18+      base         >= 4.9      && < 5     , array        >= 0.4      && < 0.6     , attoparsec   >= 0.11.3.0 && < 0.15-    , bytestring   >= 0.9.2    && < 0.12-    , containers   >= 0.4.2    && < 0.7-    , deepseq      >= 1.1      && < 1.5+    , bytestring   >= 0.10.4   && < 0.13+    , containers   >= 0.4.2    && < 0.8+    , deepseq      >= 1.1      && < 1.6     , hashable                    < 1.5     , scientific   >= 0.3.4.7  && < 0.4-    , text                        < 2.1+    , text                        < 2.2+    , text-short   == 0.1.*     , transformers >= 0.2      && < 0.7     , unordered-containers        < 0.3     , vector       >= 0.8      && < 0.14     , Only         >= 0.1      && < 0.1.1 -  if flag(bytestring--LT-0_10_4)-    build-depends: bytestring <  0.10.4-                 , bytestring-builder >= 0.10.8 && < 0.11-  else-    build-depends: bytestring >= 0.10.4-                 , text-short == 0.1.*--  -- GHC.Generics lived in `ghc-prim` for GHC 7.2 & GHC 7.4 only-  if impl(ghc < 7.6)-    build-depends: ghc-prim == 0.2.*--  -- For Numeric.Natural-  if impl(ghc < 7.10)-    build-depends: nats >= 1 && < 1.2+  ghc-options:+    -Wall+    -- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility+    -Wcompat+    -Wnoncanonical-monad-instances -  -- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility-  if impl(ghc >= 8.0)-    ghc-options: -Wcompat -Wnoncanonical-monad-instances-    if impl(ghc >= 8.8)-      ghc-options: -Wno-star-is-type-    else-      ghc-options: -Wnoncanonical-monadfail-instances+  if impl(ghc >= 8.8)+    ghc-options: -Wno-star-is-type   else-    -- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8-    build-depends: fail == 4.9.*, semigroups >= 0.18.2 && <0.20+    ghc-options: -Wnoncanonical-monadfail-instances    if impl(ghc >= 8.2)     ghc-options: -Wcpp-undef -  ghc-options: -Wall- ----------------------------------------------------------------------------  Test-suite unit-tests@@ -173,7 +148,7 @@                , vector   -- extra dependencies not already used by lib:cassava   build-depends: HUnit < 1.7-               , QuickCheck == 2.14.*+               , QuickCheck >= 2.14 && < 2.16                , quickcheck-instances >= 0.3.12 && < 0.4                , test-framework == 0.8.*                , test-framework-hunit == 0.3.*@@ -181,24 +156,16 @@    hs-source-dirs: tests -  -- GHC.Generics lived in `ghc-prim` for GHC 7.2 & GHC 7.4 only-  if impl(ghc < 7.6)-    build-depends: ghc-prim == 0.2.*--  -- For Numeric.Natural-  if impl(ghc < 7.10)-    build-depends: nats+  ghc-options:+    -Wall+    -- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility+    -Wcompat+    -Wnoncanonical-monad-instances -  -- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility-  if impl(ghc >= 8.0)-    ghc-options: -Wcompat -Wnoncanonical-monad-instances-    if impl(ghc < 8.8)-      ghc-options:  -Wnoncanonical-monadfail-instances+  if impl(ghc >= 8.8)+    ghc-options: -Wno-star-is-type   else-    -- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8-    build-depends: fail, semigroups+    ghc-options: -Wnoncanonical-monadfail-instances    if impl(ghc >= 8.2)     ghc-options: -Wcpp-undef--  ghc-options: -Wall
+ examples/NamedRecord.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE OverloadedStrings #-}++import Data.Text (Text)+import Data.Csv++data Person = Person { name :: !Text, age :: !Int }++instance ToNamedRecord Person where+    toNamedRecord (Person name age) = namedRecord [+        "name" .= name, "age" .= age]
src/Data/Csv/Conversion.hs view
@@ -12,20 +12,9 @@     TypeOperators,     UndecidableInstances     #-}--#if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-}-#endif -#if !MIN_VERSION_bytestring(0,10,4)-# define MIN_VERSION_text_short(a,b,c) 0-#endif--#if !defined(MIN_VERSION_text_short)-# error **INVARIANT BROKEN** Detected invalid combination of `text-short` and `bytestring` versions. Please verify the `pre-bytestring-0.10-4` flag-logic in the .cabal file wasn't elided.-#endif- module Data.Csv.Conversion     (     -- * Type conversion@@ -81,9 +70,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy as L-#if MIN_VERSION_bytestring(0,10,4) import qualified Data.ByteString.Short as SBS-#endif import Data.Functor.Identity import Data.List (intercalate) import Data.Hashable (Hashable)@@ -97,9 +84,7 @@ import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Encoding as LT-#if MIN_VERSION_text_short(0,1,0) import qualified Data.Text.Short as T.S-#endif import Data.Tuple.Only (Only(..)) import Data.Vector (Vector, (!)) import qualified Data.Vector as V@@ -113,25 +98,13 @@ import Data.Csv.Conversion.Internal import Data.Csv.Types -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative (Applicative, (<$>), (<*>), (<*), (*>), pure)-import Data.Monoid (Monoid, mappend, mempty)-import Data.Traversable (traverse)-import Data.Word (Word)-#endif- ------------------------------------------------------------------------ -- bytestring compatibility  toStrict   :: L.ByteString -> B.ByteString fromStrict :: B.ByteString -> L.ByteString-#if MIN_VERSION_bytestring(0,10,0) toStrict   = L.toStrict fromStrict = L.fromStrict-#else-toStrict   = B.concat . L.toChunks-fromStrict = L.fromChunks . (:[])-#endif {-# INLINE toStrict #-} {-# INLINE fromStrict #-} @@ -1018,7 +991,6 @@     toField = toStrict     {-# INLINE toField #-} -#if MIN_VERSION_bytestring(0,10,4) instance FromField SBS.ShortByteString where     parseField = pure . SBS.toShort     {-# INLINE parseField #-}@@ -1026,9 +998,7 @@ instance ToField SBS.ShortByteString where     toField = SBS.fromShort     {-# INLINE toField #-}-#endif -#if MIN_VERSION_text_short(0,1,0) -- | Assumes UTF-8 encoding. Fails on invalid byte sequences. -- -- @since 0.5.0.0@@ -1042,7 +1012,6 @@ instance ToField T.S.ShortText where     toField = T.S.toByteString     {-# INLINE toField #-}-#endif  -- | Assumes UTF-8 encoding. Fails on invalid byte sequences. instance FromField T.Text where@@ -1397,12 +1366,8 @@  -- | Instance to ensure that you cannot derive DefaultOrdered for -- constructors without selectors.-#if MIN_VERSION_base(4,9,0) instance DefaultOrdered (M1 S ('MetaSel 'Nothing srcpk srcstr decstr) a ())          => GToNamedRecordHeader (M1 S ('MetaSel 'Nothing srcpk srcstr decstr) a)-#else-instance DefaultOrdered (M1 S NoSelector a ()) => GToNamedRecordHeader (M1 S NoSelector a)-#endif   where     gtoNamedRecordHeader _ _ =         error "You cannot derive DefaultOrdered for constructors without selectors."
src/Data/Csv/Incremental.hs view
@@ -100,11 +100,6 @@ import Data.Csv.Types import Data.Csv.Util (endOfLine) -#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (Monoid(mappend, mempty))-import Control.Applicative ((<*))-#endif- -- $feed-header -- -- These functions are sometimes convenient when working with
src/Data/Csv/Parser.hs view
@@ -38,11 +38,6 @@ import Data.Csv.Types import Data.Csv.Util ((<$!>), blankLine, endOfLine, liftM2', cr, newline, doubleQuote, toStrict) -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (*>), (<*), pure)-import Data.Monoid (mappend, mempty)-#endif- -- | Options that controls how data is decoded. These options can be -- used to e.g. decode tab-separated data instead of comma-separated -- data.
src/Data/Csv/Streaming.hs view
@@ -42,15 +42,6 @@ import Data.Csv.Parser import Data.Csv.Types -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (<*>), pure)-import Data.Traversable (Traversable(..))-#endif--#if !MIN_VERSION_bytestring(0,10,0)-import qualified Data.ByteString.Lazy.Internal as BL  -- for constructors-#endif- -- $example -- -- A short usage example:@@ -98,9 +89,7 @@ -- | Skips records that failed to convert. instance Foldable Records where     foldr = foldrRecords-#if MIN_VERSION_base(4,6,0)     foldl' = foldlRecords'-#endif  foldrRecords :: (a -> b -> b) -> b -> Records a -> b foldrRecords f = go@@ -110,7 +99,6 @@     go z _ = z {-# INLINE foldrRecords #-} -#if MIN_VERSION_base(4,6,0) foldlRecords' :: (a -> b -> a) -> a -> Records b -> a foldlRecords' f = go   where@@ -118,7 +106,6 @@     go z (Cons (Left _) rs) = go z rs     go z _ = z {-# INLINE foldlRecords' #-}-#endif  instance Traversable Records where     traverse _ (Nil merr rest) = pure $ Nil merr rest@@ -129,15 +116,7 @@  instance NFData a => NFData (Records a) where     rnf (Cons r rs) = rnf r `seq` rnf rs-#if MIN_VERSION_bytestring(0,10,0)     rnf (Nil errMsg rest) = rnf errMsg `seq` rnf rest-#else-    rnf (Nil errMsg rest) = rnf errMsg `seq` rnfLazyByteString rest--rnfLazyByteString :: BL.ByteString -> ()-rnfLazyByteString BL.Empty       = ()-rnfLazyByteString (BL.Chunk _ b) = rnfLazyByteString b-#endif  -- | Efficiently deserialize CSV records in a streaming fashion. -- Equivalent to @'decodeWith' 'defaultDecodeOptions'@.
src/Data/Csv/Util.hs view
@@ -18,19 +18,7 @@ import qualified Data.ByteString as B import qualified Data.Vector as V import Data.Attoparsec.ByteString (Parser)--#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((*>))-#endif--#if MIN_VERSION_bytestring(0,10,0) import Data.ByteString.Lazy (toStrict)-#else-import qualified Data.ByteString.Lazy as L--toStrict :: L.ByteString -> B.ByteString-toStrict = B.concat . L.toChunks-#endif  -- | A strict version of 'Data.Functor.<$>' for monads. (<$!>) :: Monad m => (a -> b) -> m a -> m b
tests/UnitTests.hs view
@@ -1,10 +1,6 @@ {-# LANGUAGE CPP, DataKinds, DeriveGeneric, OverloadedStrings, ScopedTypeVariables #-} -#if __GLASGOW_HASKELL__ >= 801 {-# OPTIONS_GHC -Wno-orphans -Wno-unused-top-binds #-}-#else-{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-unused-binds #-}-#endif  module Main     ( main@@ -34,10 +30,6 @@ import Data.Csv hiding (record) import qualified Data.Csv.Streaming as S -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (<*>))-#endif- ------------------------------------------------------------------------ -- Parse tests @@ -304,15 +296,8 @@         (roundTrip :: BL.ByteString -> Bool)       , testProperty "Text" (roundTrip :: T.Text -> Bool)       , testProperty "lazy Text" (roundTrip :: LT.Text -> Bool)--#if __GLASGOW_HASKELL__ >= 800       -- Using DataKinds here to prove that our Const instance is polykinded.       , testProperty "Const Char" (roundTrip :: Const Char "" -> Bool)-#else-      -- For lower GHC versions, Const does not support PolyKinds.-      , testProperty "Const Char" (roundTrip :: Const Char () -> Bool)-#endif-       ]     , testGroup "boundary"       [ testProperty "Int" (boundary (undefined :: Int))