Skip to content

Commit 112f45b

Browse files
AlistairBLysxia
authored andcommitted
Avoid 'iff' for clarity
Instead write it in full as 'if and only if'.
1 parent 40a48d6 commit 112f45b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Data/Text.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ minimum t = S.minimum (stream t)
10421042
-- __Properties__
10431043
--
10441044
-- @'head' ('scanl' f z xs) = z@
1045-
--
1045+
--
10461046
-- @'last' ('scanl' f z xs) = 'foldl' f z xs@
10471047
scanl :: (Char -> Char -> Char) -> Char -> Text -> Text
10481048
scanl f z t = unstream (S.scanl g z (stream t))
@@ -1848,14 +1848,14 @@ unwords = intercalate (singleton ' ')
18481848
{-# INLINE unwords #-}
18491849

18501850
-- | /O(n)/ The 'isPrefixOf' function takes two 'Text's and returns
1851-
-- 'True' iff the first is a prefix of the second.
1851+
-- 'True' if and only if the first is a prefix of the second.
18521852
isPrefixOf :: Text -> Text -> Bool
18531853
isPrefixOf a@(Text _ _ alen) b@(Text _ _ blen) =
18541854
alen <= blen && S.isPrefixOf (stream a) (stream b)
18551855
{-# INLINE [1] isPrefixOf #-}
18561856

18571857
-- | /O(n)/ The 'isSuffixOf' function takes two 'Text's and returns
1858-
-- 'True' iff the first is a suffix of the second.
1858+
-- 'True' if and only if the first is a suffix of the second.
18591859
isSuffixOf :: Text -> Text -> Bool
18601860
isSuffixOf a@(Text _aarr _aoff alen) b@(Text barr boff blen) =
18611861
d >= 0 && a == b'
@@ -1865,7 +1865,7 @@ isSuffixOf a@(Text _aarr _aoff alen) b@(Text barr boff blen) =
18651865
{-# INLINE isSuffixOf #-}
18661866

18671867
-- | /O(n+m)/ The 'isInfixOf' function takes two 'Text's and returns
1868-
-- 'True' iff the first is contained, wholly and intact, anywhere
1868+
-- 'True' if and only if the first is contained, wholly and intact, anywhere
18691869
-- within the second.
18701870
--
18711871
-- In (unlikely) bad cases, this function's time complexity degrades

src/Data/Text/Internal/Fusion/Common.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ minimum (Stream next0 s0 _len) = loop0_minimum s0
834834
-- __Properties__
835835
--
836836
-- @'head' ('scanl' f z xs) = z@
837-
--
837+
--
838838
-- @'last' ('scanl' f z xs) = 'foldl' f z xs@
839839
scanl :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream Char
840840
scanl f z0 (Stream next0 s0 len) = Stream next (Scan1 z0 s0) (len+1) -- HINT maybe too low
@@ -1008,7 +1008,7 @@ dropWhile p (Stream next0 s0 len) = Stream next (L s0) (len - unknownSize)
10081008
{-# INLINE [0] dropWhile #-}
10091009

10101010
-- | /O(n)/ The 'isPrefixOf' function takes two 'Stream's and returns
1011-
-- 'True' iff the first is a prefix of the second.
1011+
-- 'True' if and only if the first is a prefix of the second.
10121012
--
10131013
-- __Properties__
10141014
--

src/Data/Text/Lazy.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ unwords = intercalate (singleton ' ')
14601460
{-# INLINE unwords #-}
14611461

14621462
-- | /O(n)/ The 'isPrefixOf' function takes two 'Text's and returns
1463-
-- 'True' iff the first is a prefix of the second.
1463+
-- 'True' if and only if the first is a prefix of the second.
14641464
isPrefixOf :: Text -> Text -> Bool
14651465
isPrefixOf Empty _ = True
14661466
isPrefixOf _ Empty = False
@@ -1474,14 +1474,14 @@ isPrefixOf (Chunk x xs) (Chunk y ys)
14741474
ly = T.length y
14751475

14761476
-- | /O(n)/ The 'isSuffixOf' function takes two 'Text's and returns
1477-
-- 'True' iff the first is a suffix of the second.
1477+
-- 'True' if and only if the first is a suffix of the second.
14781478
isSuffixOf :: Text -> Text -> Bool
14791479
isSuffixOf x y = reverse x `isPrefixOf` reverse y
14801480
{-# INLINE isSuffixOf #-}
14811481
-- TODO: a better implementation
14821482

14831483
-- | /O(n+m)/ The 'isInfixOf' function takes two 'Text's and returns
1484-
-- 'True' iff the first is contained, wholly and intact, anywhere
1484+
-- 'True' if and only if the first is contained, wholly and intact, anywhere
14851485
-- within the second.
14861486
--
14871487
-- This function is strict in its first argument, and lazy in its

0 commit comments

Comments
 (0)