@@ -207,7 +207,7 @@ import Prelude ()
207207import Control.Applicative ((<$>) , (<**>) , Alternative ,
208208 liftA3 )
209209import qualified Control.Applicative as Applicative
210- import Control.DeepSeq (NFData (rnf ))
210+ import Control.DeepSeq (NFData (rnf ), NFData1 ( liftRnf ) )
211211import Control.Monad (MonadPlus (.. ))
212212import Data.Monoid (Monoid (.. ))
213213import Data.Functor (Functor (.. ))
@@ -504,6 +504,10 @@ instance Traversable Seq where
504504instance NFData a => NFData (Seq a ) where
505505 rnf (Seq xs) = rnf xs
506506
507+ -- | @since 0.7.1
508+ instance NFData1 Seq where
509+ liftRnf rnfx (Seq xs) = liftRnf (liftRnf rnfx) xs
510+
507511instance Monad Seq where
508512 return = pure
509513 xs >>= f = foldl' add empty xs
@@ -1170,6 +1174,12 @@ instance NFData a => NFData (FingerTree a) where
11701174 rnf (Single x) = rnf x
11711175 rnf (Deep _ pr m sf) = rnf pr `seq` rnf sf `seq` rnf m
11721176
1177+ -- | @since 0.7.1
1178+ instance NFData1 FingerTree where
1179+ liftRnf _ EmptyT = ()
1180+ liftRnf rnfx (Single x) = rnfx x
1181+ liftRnf rnfx (Deep _ pr m sf) = liftRnf rnfx pr `seq` liftRnf (liftRnf rnfx) m `seq` liftRnf rnfx sf
1182+
11731183{-# INLINE deep #-}
11741184deep :: Sized a => Digit a -> FingerTree (Node a ) -> Digit a -> FingerTree a
11751185deep pr m sf = Deep (size pr + size m + size sf) pr m sf
@@ -1272,6 +1282,13 @@ instance NFData a => NFData (Digit a) where
12721282 rnf (Three a b c) = rnf a `seq` rnf b `seq` rnf c
12731283 rnf (Four a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d
12741284
1285+ -- | @since 0.7.1
1286+ instance NFData1 Digit where
1287+ liftRnf rnfx (One a) = rnfx a
1288+ liftRnf rnfx (Two a b) = rnfx a `seq` rnfx b
1289+ liftRnf rnfx (Three a b c) = rnfx a `seq` rnfx b `seq` rnfx c
1290+ liftRnf rnfx (Four a b c d) = rnfx a `seq` rnfx b `seq` rnfx c `seq` rnfx d
1291+
12751292instance Sized a => Sized (Digit a ) where
12761293 {-# INLINE size #-}
12771294 size = foldl1 (+) . fmap size
@@ -1350,6 +1367,11 @@ instance NFData a => NFData (Node a) where
13501367 rnf (Node2 _ a b) = rnf a `seq` rnf b
13511368 rnf (Node3 _ a b c) = rnf a `seq` rnf b `seq` rnf c
13521369
1370+ -- | @since 0.7.1
1371+ instance NFData1 Node where
1372+ liftRnf rnfx (Node2 _ a b) = rnfx a `seq` rnfx b
1373+ liftRnf rnfx (Node3 _ a b c) = rnfx a `seq` rnfx b `seq` rnfx c
1374+
13531375instance Sized (Node a ) where
13541376 size (Node2 v _ _) = v
13551377 size (Node3 v _ _ _) = v
@@ -1410,6 +1432,10 @@ instance Traversable Elem where
14101432instance NFData a => NFData (Elem a ) where
14111433 rnf (Elem x) = rnf x
14121434
1435+ -- | @since 0.7.1
1436+ instance NFData1 Elem where
1437+ liftRnf rnfx (Elem x) = rnfx x
1438+
14131439-------------------------------------------------------
14141440-- Applicative construction
14151441-------------------------------------------------------
0 commit comments