Skip to content

Commit

Permalink
Add UArray instances.
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisWhitaker committed Sep 21, 2019
1 parent e90c6b6 commit c9d12bf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Control/DeepSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import Data.Word
import Data.Ratio
import Data.Complex
import Data.Array
import Data.Array.Unboxed (UArray)
import Data.Fixed
import Data.Version
import Data.Monoid as Mon
Expand Down Expand Up @@ -611,6 +612,30 @@ instance NFData2 Array where
liftRnf2 r r' x = liftRnf2 r r (bounds x) `seq` liftRnf r' (Data.Array.elems x)
#endif

#if __GLASGOW_HASKELL__ >= 711
-- |@since 1.4.5.0
instance (NFData i, NFData e) => NFData (UArray i e) where
#else
-- |@since 1.4.5.0
instance (Ix i, NFData i, NFData e) => NFData (UArray i e) where
#endif
rnf = rwhnf

#if __GLASGOW_HASKELL__ >= 711
-- |@since 1.4.5.0
instance (NFData i) => NFData1 (UArray i) where
#else
-- |@since 1.4.5.0
instance (Ix i, NFData i) => NFData1 (UArray a) where
#endif
liftRnf _ = rwhnf

#if __GLASGOW_HASKELL__ >= 711
-- |@since 1.4.5.0
instance NFData2 UArray where
liftRnf2 _ _ = rwhnf
#endif

-- |@since 1.4.0.0
instance NFData a => NFData (Down a) where rnf = rnf1
-- |@since 1.4.3.0
Expand Down

0 comments on commit c9d12bf

Please sign in to comment.