@@ -208,7 +208,7 @@ import Prelude ()
208208import Control.Applicative ((<$>) , (<**>) , Alternative ,
209209 liftA3 )
210210import qualified Control.Applicative as Applicative
211- import Control.DeepSeq (NFData (rnf ))
211+ import Control.DeepSeq (NFData (rnf ), NFData1 ( liftRnf ) )
212212import Control.Monad (MonadPlus (.. ))
213213import Data.Monoid (Monoid (.. ))
214214import Data.Functor (Functor (.. ))
@@ -518,6 +518,10 @@ instance Traversable Seq where
518518instance NFData a => NFData (Seq a ) where
519519 rnf (Seq xs) = rnf xs
520520
521+ -- | @since 0.7.1
522+ instance NFData1 Seq where
523+ liftRnf rnfx (Seq xs) = liftRnf (liftRnf rnfx) xs
524+
521525instance Monad Seq where
522526 return = pure
523527 xs >>= f = foldl' add empty xs
@@ -1227,6 +1231,12 @@ instance NFData a => NFData (FingerTree a) where
12271231 rnf (Single x) = rnf x
12281232 rnf (Deep _ pr m sf) = rnf pr `seq` rnf sf `seq` rnf m
12291233
1234+ -- | @since 0.7.1
1235+ instance NFData1 FingerTree where
1236+ liftRnf _ EmptyT = ()
1237+ liftRnf rnfx (Single x) = rnfx x
1238+ liftRnf rnfx (Deep _ pr m sf) = liftRnf rnfx pr `seq` liftRnf (liftRnf rnfx) m `seq` liftRnf rnfx sf
1239+
12301240{-# INLINE deep #-}
12311241deep :: Sized a => Digit a -> FingerTree (Node a ) -> Digit a -> FingerTree a
12321242deep pr m sf = Deep (size pr + size m + size sf) pr m sf
@@ -1329,6 +1339,13 @@ instance NFData a => NFData (Digit a) where
13291339 rnf (Three a b c) = rnf a `seq` rnf b `seq` rnf c
13301340 rnf (Four a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d
13311341
1342+ -- | @since 0.7.1
1343+ instance NFData1 Digit where
1344+ liftRnf rnfx (One a) = rnfx a
1345+ liftRnf rnfx (Two a b) = rnfx a `seq` rnfx b
1346+ liftRnf rnfx (Three a b c) = rnfx a `seq` rnfx b `seq` rnfx c
1347+ liftRnf rnfx (Four a b c d) = rnfx a `seq` rnfx b `seq` rnfx c `seq` rnfx d
1348+
13321349instance Sized a => Sized (Digit a ) where
13331350 {-# INLINE size #-}
13341351 size = foldl1 (+) . fmap size
@@ -1407,6 +1424,11 @@ instance NFData a => NFData (Node a) where
14071424 rnf (Node2 _ a b) = rnf a `seq` rnf b
14081425 rnf (Node3 _ a b c) = rnf a `seq` rnf b `seq` rnf c
14091426
1427+ -- | @since 0.7.1
1428+ instance NFData1 Node where
1429+ liftRnf rnfx (Node2 _ a b) = rnfx a `seq` rnfx b
1430+ liftRnf rnfx (Node3 _ a b c) = rnfx a `seq` rnfx b `seq` rnfx c
1431+
14101432instance Sized (Node a ) where
14111433 size (Node2 v _ _) = v
14121434 size (Node3 v _ _ _) = v
@@ -1467,6 +1489,10 @@ instance Traversable Elem where
14671489instance NFData a => NFData (Elem a ) where
14681490 rnf (Elem x) = rnf x
14691491
1492+ -- | @since 0.7.1
1493+ instance NFData1 Elem where
1494+ liftRnf rnfx (Elem x) = rnfx x
1495+
14701496-------------------------------------------------------
14711497-- Applicative construction
14721498-------------------------------------------------------
0 commit comments