Permalink
Browse files

Add NFData instance for Records

  • Loading branch information...
tibbe committed Feb 25, 2013
1 parent a5b13ef commit 6ab7c28852fd553140b293ed7b951ee8ac772b6a
Showing with 6 additions and 0 deletions.
  1. +5 −0 Data/Csv/Streaming.hs
  2. +1 −0 cassava.cabal
View
@@ -28,6 +28,7 @@ module Data.Csv.Streaming
) where
import Control.Applicative ((<$>), (<*>), pure)
+import Control.DeepSeq (NFData(rnf))
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BL8
@@ -116,6 +117,10 @@ instance Traversable Records where
traverseElem (Left err) = pure $ Left err
traverseElem (Right y) = Right <$> f y
+instance NFData a => NFData (Records a) where
+ rnf (Cons r rs) = rnf r `seq` rnf rs
+ rnf (Nil errMsg rest) = rnf errMsg `seq` rnf rest
+
-- | Efficiently deserialize CSV records in a streaming fashion.
-- Equivalent to @'decodeWith' 'defaultDecodeOptions'@.
decode :: FromRecord a
View
@@ -41,6 +41,7 @@ Library
blaze-builder < 0.4,
bytestring < 0.11,
containers < 0.6,
+ deepseq < 1.4,
text < 0.12,
unordered-containers < 0.3,
vector < 0.11

0 comments on commit 6ab7c28

Please sign in to comment.