on master help sign in
Document case conversion functions as subject to stream fusion
commit8ee20a0b9968994fd8e98c5fe0a5a3a27d7d6d34 authorBryan O'Sullivan <bos@serpentine.com> dateSat 30 Nov 2013, 22:43 (13 years ago) parent104c422
2 files changed+30−20
Data/Text.hs+15−10 Data/Text/Lazy.hs+15−10
Data/Text.hs+15−10
@@ -644,9 +644,10 @@ replace s d = intercalate d . splitOn s
644644-- functions from the @text-icu@ package:
645645-- <http://hackage.haskell.org/package/text-icu>
646646
647−-- | /O(n)/ Convert a string to folded case. This function is mainly
648−-- useful for performing caseless (also known as case insensitive)
649−-- string comparisons.
647+-- | /O(n)/ Convert a string to folded case. Subject to fusion.
648+--
649+-- This function is mainly useful for performing caseless (also known
650+-- as case insensitive) string comparisons.
650651--
651652-- A string @x@ is a caseless match for a string @y@ if and only if:
652653--
@@ -664,24 +665,28 @@ toCaseFold t = unstream (S.toCaseFold (stream t))
664665{-# INLINE [0] toCaseFold #-}
665666
666667-- | /O(n)/ Convert a string to lower case, using simple case
667−-- conversion. The result string may be longer than the input string.
668−-- For instance, \"&#x130;\" (Latin capital letter I with dot above,
669−-- U+0130) maps to the sequence \"i\" (Latin small letter i, U+0069) followed
670−-- by \" &#x307;\" (combining dot above, U+0307).
668+-- conversion. Subject to fusion.
669+--
670+-- The result string may be longer than the input string. For
671+-- instance, \"&#x130;\" (Latin capital letter I with dot above,
672+-- U+0130) maps to the sequence \"i\" (Latin small letter i, U+0069)
673+-- followed by \" &#x307;\" (combining dot above, U+0307).
671674toLower :: Text -> Text
672675toLower t = unstream (S.toLower (stream t))
673676{-# INLINE toLower #-}
674677
675678-- | /O(n)/ Convert a string to upper case, using simple case
676−-- conversion. The result string may be longer than the input string.
677−-- For instance, the German \"&#xdf;\" (eszett, U+00DF) maps to the
679+-- conversion. Subject to fusion.
680+--
681+-- The result string may be longer than the input string. For
682+-- instance, the German \"&#xdf;\" (eszett, U+00DF) maps to the
678683-- two-letter sequence \"SS\".
679684toUpper :: Text -> Text
680685toUpper t = unstream (S.toUpper (stream t))
681686{-# INLINE toUpper #-}
682687
683688-- | /O(n)/ Convert a string to title case, using simple case
684−-- conversion.
689+-- conversion. Subject to fusion.
685690--
686691-- Unlike the other case conversion functions, this function does not
687692-- convert every letter of its input. Instead, the first letter is
Data/Text/Lazy.hs+15−10
@@ -663,9 +663,10 @@ replace s d = intercalate d . splitOn s
663663-- functions may map one input character to two or three output
664664-- characters.
665665
666−-- | /O(n)/ Convert a string to folded case. This function is mainly
667−-- useful for performing caseless (or case insensitive) string
668−-- comparisons.
666+-- | /O(n)/ Convert a string to folded case. Subject to fusion.
667+--
668+-- This function is mainly useful for performing caseless (or case
669+-- insensitive) string comparisons.
669670--
670671-- A string @x@ is a caseless match for a string @y@ if and only if:
671672--
@@ -682,17 +683,21 @@ toCaseFold t = unstream (S.toCaseFold (stream t))
682683{-# INLINE [0] toCaseFold #-}
683684
684685-- | /O(n)/ Convert a string to lower case, using simple case
685−-- conversion. The result string may be longer than the input string.
686−-- For instance, the Latin capital letter I with dot above (U+0130)
687−-- maps to the sequence Latin small letter i (U+0069) followed by
688−-- combining dot above (U+0307).
686+-- conversion. Subject to fusion.
687+--
688+-- The result string may be longer than the input string. For
689+-- instance, the Latin capital letter I with dot above (U+0130) maps
690+-- to the sequence Latin small letter i (U+0069) followed by combining
691+-- dot above (U+0307).
689692toLower :: Text -> Text
690693toLower t = unstream (S.toLower (stream t))
691694{-# INLINE toLower #-}
692695
693696-- | /O(n)/ Convert a string to upper case, using simple case
694−-- conversion. The result string may be longer than the input string.
695−-- For instance, the German eszett (U+00DF) maps to the two-letter
697+-- conversion. Subject to fusion.
698+--
699+-- The result string may be longer than the input string. For
700+-- instance, the German eszett (U+00DF) maps to the two-letter
696701-- sequence SS.
697702toUpper :: Text -> Text
698703toUpper t = unstream (S.toUpper (stream t))
@@ -700,7 +705,7 @@ toUpper t = unstream (S.toUpper (stream t))
700705
701706
702707-- | /O(n)/ Convert a string to title case, using simple case
703−-- conversion.
708+-- conversion. Subject to fusion.
704709--
705710-- Unlike the other case conversion functions, this function does not
706711-- convert every letter of its input. Instead, the first letter is