on master help sign in
Drop unnecessary uses of seq

Since the Step type has strict elements, further use of seq brings no benefit --HG-- extra : convert_revision : 6c910386012ddb363c8994fd42bafd104c6e68eb

commit5c8ab4e775713ca682c9b755c96b571f40462294 authorBryan O'Sullivan <bos@serpentine.com> dateMon 19 Jan 2009, 12:48 (18 years ago) parentf81a471
2 files changed+26−26
Data/Text.hs+4−4 Data/Text/Fusion.hs+22−22
Data/Text.hs+4−4
@@ -55,8 +55,8 @@ import Prelude (Char,Bool,Int,Maybe,String,
5555 Eq,(==),(++),error,
5656 Show,showsPrec,
5757 Read,readsPrec,
58− (&&),(||),(+),(-),($),(<),(>),(<=),(>=),(.),(>>=),
59− return,otherwise,seq,
58+ (&&),(||),(+),(-),(<),(>),(<=),(>=),(.),(>>=),
59+ return,otherwise,
6060 IO, FilePath)
6161
6262import Data.Char (isSpace)
@@ -122,8 +122,8 @@ unpack txt = (unstream_list (stream txt))
122122 where
123123 unfold !s = case next s of
124124 S.Done -> []
125− S.Skip s' -> seq s' $ unfold s'
126− S.Yield x s' -> seq s' $ x : unfold s'
125+ S.Skip s' -> unfold s'
126+ S.Yield x s' -> x : unfold s'
127127{-# INLINE [1] unpack #-}
128128
129129-- | Convert a character into a Text.
Data/Text/Fusion.hs+22−22
@@ -469,12 +469,12 @@ last (Stream next s0 _len) = loop0_last s0
469469 where
470470 loop0_last !s = case next s of
471471 Done -> error "last: Empty list"
472− Skip s' -> seq s' $ loop0_last s'
473− Yield x s' -> seq s' $ loop_last x s'
472+ Skip s' -> loop0_last s'
473+ Yield x s' -> loop_last x s'
474474 loop_last !x !s = case next s of
475475 Done -> x
476− Skip s' -> seq s' $ loop_last x s'
477− Yield x' s' -> seq s' $ loop_last x' s'
476+ Skip s' -> loop_last x s'
477+ Yield x' s' -> loop_last x' s'
478478{-# INLINE[0] last #-}
479479
480480-- | /O(1)/ Returns all characters after the head of a Stream Char, which must
@@ -502,12 +502,12 @@ init (Stream next0 s0 len) = Stream next (Nothing :!: s0) (len-1)
502502 {-# INLINE next #-}
503503 next (Nothing :!: s) = case next0 s of
504504 Done -> errorEmptyList "init"
505− Skip s' -> seq s' $ Skip (Nothing :!: s')
506− Yield x s' -> seq s' $ Skip (Just x :!: s')
505+ Skip s' -> Skip (Nothing :!: s')
506+ Yield x s' -> Skip (Just x :!: s')
507507 next (Just x :!: s) = case next0 s of
508508 Done -> Done
509− Skip s' -> seq s' $ Skip (Just x :!: s')
510− Yield x' s' -> seq s' $ Yield x (Just x' :!: s')
509+ Skip s' -> Skip (Just x :!: s')
510+ Yield x' s' -> Yield x (Just x' :!: s')
511511{-# INLINE [0] init #-}
512512
513513-- | /O(1)/ Tests whether a Stream Char is empty or not.
@@ -673,9 +673,9 @@ any p (Stream next0 s0 _len) = loop_any s0
673673 where
674674 loop_any !s = case next0 s of
675675 Done -> False
676− Skip s' -> seq s' $ loop_any s'
676+ Skip s' -> loop_any s'
677677 Yield x s' | p x -> True
678− | otherwise -> seq s' $ loop_any s'
678+ | otherwise -> loop_any s'
679679
680680-- | /O(n)/ all @p @xs determines if all characters in the 'Text'
681681-- @xs@ satisify the predicate @p@.
@@ -684,8 +684,8 @@ all p (Stream next0 s0 _len) = loop_all s0
684684 where
685685 loop_all !s = case next0 s of
686686 Done -> True
687− Skip s' -> seq s' $ loop_all s'
688− Yield x s' | p x -> seq s' $ loop_all s'
687+ Skip s' -> loop_all s'
688+ Yield x s' | p x -> loop_all s'
689689 | otherwise -> False
690690
691691-- | /O(n)/ maximum returns the maximum value from a stream, which must be
@@ -695,14 +695,14 @@ maximum (Stream next0 s0 _len) = loop0_maximum s0
695695 where
696696 loop0_maximum !s = case next0 s of
697697 Done -> errorEmptyList "maximum"
698− Skip s' -> seq s' $ loop0_maximum s'
699− Yield x s' -> seq s' $ loop_maximum x s'
698+ Skip s' -> loop0_maximum s'
699+ Yield x s' -> loop_maximum x s'
700700 loop_maximum !z !s = case next0 s of
701701 Done -> z
702− Skip s' -> seq s' $ loop_maximum z s'
702+ Skip s' -> loop_maximum z s'
703703 Yield x s'
704− | x > z -> seq s' $ loop_maximum x s'
705− | otherwise -> seq s' $ loop_maximum z s'
704+ | x > z -> loop_maximum x s'
705+ | otherwise -> loop_maximum z s'
706706
707707-- | /O(n)/ minimum returns the minimum value from a 'Text', which must be
708708-- non-empty.
@@ -711,14 +711,14 @@ minimum (Stream next0 s0 _len) = loop0_minimum s0
711711 where
712712 loop0_minimum !s = case next0 s of
713713 Done -> errorEmptyList "minimum"
714− Skip s' -> seq s' $ loop0_minimum s'
715− Yield x s' -> seq s' $ loop_minimum x s'
714+ Skip s' -> loop0_minimum s'
715+ Yield x s' -> loop_minimum x s'
716716 loop_minimum !z !s = case next0 s of
717717 Done -> z
718− Skip s' -> seq s' $ loop_minimum z s'
718+ Skip s' -> loop_minimum z s'
719719 Yield x s'
720− | x < z -> seq s' $ loop_minimum x s'
721− | otherwise -> seq s' $ loop_minimum z s'
720+ | x < z -> loop_minimum x s'
721+ | otherwise -> loop_minimum z s'
722722
723723
724724