Skip to content

Commit b484fe8

Browse files
Add NFData1 instance
1 parent 6e898cd commit b484fe8

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ where
206206

207207
import Control.Exception (assert)
208208
import Control.DeepSeq (NFData(..))
209+
#if MIN_VERSION_deepseq(1,4,3)
210+
import Control.DeepSeq (NFData1(..))
211+
#endif
209212
import Control.Monad (when, void)
210213
import Control.Monad.IO.Class (MonadIO(..))
211214
import Data.Bits (shiftR, (.|.), (.&.))
@@ -2286,3 +2289,9 @@ cmp arr1 arr2 =
22862289
instance 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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ where
7878

7979
import Control.Exception (assert)
8080
import Control.DeepSeq (NFData(..))
81+
#if MIN_VERSION_deepseq(1,4,3)
82+
import Control.DeepSeq (NFData1(..))
83+
#endif
8184
import Control.Monad.IO.Class (MonadIO(..))
8285
import Data.Functor.Identity (Identity(..))
8386
import 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+
741749
instance (Storable a, Ord a) => Ord (Array a) where
742750
{-# INLINE compare #-}
743751
compare arr1 arr2 = runIdentity $

0 commit comments

Comments
 (0)