Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Old bytestring doesn't have NFData instance

  • Loading branch information...
commit f5e9c019415589f5be412eeb7c3ba4b469b32c16 1 parent 50f2e53
@tibbe authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 Data/Csv/Streaming.hs
View
12 Data/Csv/Streaming.hs
@@ -43,6 +43,10 @@ import qualified Data.Csv.Incremental as I
import Data.Csv.Parser
import Data.Csv.Types
+#if !MIN_VERSION_bytestring(0,10,0)
+import qualified Data.ByteString.Lazy.Internal as BL -- for constructors
+#endif
+
-- $example
--
-- A short usage example:
@@ -119,7 +123,15 @@ instance Traversable Records where
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'@.
Please sign in to comment.
Something went wrong with that request. Please try again.