on master help sign in
Add NFData1 instance
commitb484fe8a729de4582fc1a2074ea998d3df1c8ca3 authorHarendra Kumar <harendra@composewell.com> dateWed 6 Oct 2021, 16:32 (5 years ago) parent6e898cd
2 files changed+17
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs+9 src/Streamly/Internal/Data/Array/Foreign/Type.hs+8
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs+9
@@ -206,6 +206,9 @@ where
206206
207207import Control.Exception (assert)
208208import Control.DeepSeq (NFData(..))
209+#if MIN_VERSION_deepseq(1,4,3)
210+import Control.DeepSeq (NFData1(..))
211+#endif
209212import Control.Monad (when, void)
210213import Control.Monad.IO.Class (MonadIO(..))
211214import Data.Bits (shiftR, (.|.), (.&.))
@@ -2286,3 +2289,9 @@ cmp arr1 arr2 =
22862289instance NFData (Array a) where
22872290 {-# INLINE rnf #-}
22882291 rnf Array {} = ()
2292+
2293+#if MIN_VERSION_deepseq(1,4,3)
2294+instance NFData1 Array where
2295+ {-# INLINE liftRnf #-}
2296+ liftRnf _ Array{} = ()
2297+#endif
src/Streamly/Internal/Data/Array/Foreign/Type.hs+8
@@ -78,6 +78,9 @@ where
7878
7979import Control.Exception (assert)
8080import Control.DeepSeq (NFData(..))
81+#if MIN_VERSION_deepseq(1,4,3)
82+import Control.DeepSeq (NFData1(..))
83+#endif
8184import Control.Monad.IO.Class (MonadIO(..))
8285import Data.Functor.Identity (Identity(..))
8386import Data.Word (Word8)
@@ -738,6 +741,11 @@ instance NFData (Array a) where
738741 {-# INLINE rnf #-}
739742 rnf Array {} = ()
740743
744+#if MIN_VERSION_deepseq(1,4,3)
745+instance NFData1 Array where
746+ liftRnf _ Array{} = ()
747+#endif
748+
741749instance (Storable a, Ord a) => Ord (Array a) where
742750 {-# INLINE compare #-}
743751 compare arr1 arr2 = runIdentity $