on master help sign in
Document case conversion functions as subject to stream fusion
8ee20a0Bryan O'Sullivan
Data/Text.hs+15−10
@@ -644,9 +644,10 @@ replace s d = intercalate d . splitOn s
644-- functions from the @text-icu@ package:
644-- functions from the @text-icu@ package:
645-- <http://hackage.haskell.org/package/text-icu>
645-- <http://hackage.haskell.org/package/text-icu>
646
646
647−-- | /O(n)/ Convert a string to folded case. This function is mainly
647+-- | /O(n)/ Convert a string to folded case. Subject to fusion.
648+--
648−-- useful for performing caseless (also known as case insensitive)
649+-- This function is mainly useful for performing caseless (also known
649−-- string comparisons.
650+-- as case insensitive) string comparisons.
650--
651--
651-- A string @x@ is a caseless match for a string @y@ if and only if:
652-- A string @x@ is a caseless match for a string @y@ if and only if:
652--
653--
@@ -664,24 +665,28 @@ toCaseFold t = unstream (S.toCaseFold (stream t))
664{-# INLINE [0] toCaseFold #-}
665{-# INLINE [0] toCaseFold #-}
665
666
666-- | /O(n)/ Convert a string to lower case, using simple case
667-- | /O(n)/ Convert a string to lower case, using simple case
668+-- conversion. Subject to fusion.
669+--
667−-- conversion. The result string may be longer than the input string.
670+-- The result string may be longer than the input string. For
668−-- For instance, \"&#x130;\" (Latin capital letter I with dot above,
671+-- instance, \"&#x130;\" (Latin capital letter I with dot above,
669−-- U+0130) maps to the sequence \"i\" (Latin small letter i, U+0069) followed
672+-- U+0130) maps to the sequence \"i\" (Latin small letter i, U+0069)
670−-- by \" &#x307;\" (combining dot above, U+0307).
673+-- followed by \" &#x307;\" (combining dot above, U+0307).
671toLower :: Text -> Text
674toLower :: Text -> Text
672toLower t = unstream (S.toLower (stream t))
675toLower t = unstream (S.toLower (stream t))
673{-# INLINE toLower #-}
676{-# INLINE toLower #-}
674
677
675-- | /O(n)/ Convert a string to upper case, using simple case
678-- | /O(n)/ Convert a string to upper case, using simple case
679+-- conversion. Subject to fusion.
680+--
676−-- conversion. The result string may be longer than the input string.
681+-- The result string may be longer than the input string. For
677−-- For instance, the German \"&#xdf;\" (eszett, U+00DF) maps to the
682+-- instance, the German \"&#xdf;\" (eszett, U+00DF) maps to the
678-- two-letter sequence \"SS\".
683-- two-letter sequence \"SS\".
679toUpper :: Text -> Text
684toUpper :: Text -> Text
680toUpper t = unstream (S.toUpper (stream t))
685toUpper t = unstream (S.toUpper (stream t))
681{-# INLINE toUpper #-}
686{-# INLINE toUpper #-}
682
687
683-- | /O(n)/ Convert a string to title case, using simple case
688-- | /O(n)/ Convert a string to title case, using simple case
684−-- conversion.
689+-- conversion. Subject to fusion.
685--
690--
686-- Unlike the other case conversion functions, this function does not
691-- Unlike the other case conversion functions, this function does not
687-- convert every letter of its input. Instead, the first letter is
692-- 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
663-- functions may map one input character to two or three output
663-- functions may map one input character to two or three output
664-- characters.
664-- characters.
665
665
666−-- | /O(n)/ Convert a string to folded case. This function is mainly
666+-- | /O(n)/ Convert a string to folded case. Subject to fusion.
667+--
667−-- useful for performing caseless (or case insensitive) string
668+-- This function is mainly useful for performing caseless (or case
668−-- comparisons.
669+-- insensitive) string comparisons.
669--
670--
670-- A string @x@ is a caseless match for a string @y@ if and only if:
671-- A string @x@ is a caseless match for a string @y@ if and only if:
671--
672--
@@ -682,17 +683,21 @@ toCaseFold t = unstream (S.toCaseFold (stream t))
682{-# INLINE [0] toCaseFold #-}
683{-# INLINE [0] toCaseFold #-}
683
684
684-- | /O(n)/ Convert a string to lower case, using simple case
685-- | /O(n)/ Convert a string to lower case, using simple case
686+-- conversion. Subject to fusion.
687+--
685−-- conversion. The result string may be longer than the input string.
688+-- The result string may be longer than the input string. For
686−-- For instance, the Latin capital letter I with dot above (U+0130)
689+-- instance, the Latin capital letter I with dot above (U+0130) maps
687−-- maps to the sequence Latin small letter i (U+0069) followed by
690+-- to the sequence Latin small letter i (U+0069) followed by combining
688−-- combining dot above (U+0307).
691+-- dot above (U+0307).
689toLower :: Text -> Text
692toLower :: Text -> Text
690toLower t = unstream (S.toLower (stream t))
693toLower t = unstream (S.toLower (stream t))
691{-# INLINE toLower #-}
694{-# INLINE toLower #-}
692
695
693-- | /O(n)/ Convert a string to upper case, using simple case
696-- | /O(n)/ Convert a string to upper case, using simple case
697+-- conversion. Subject to fusion.
698+--
694−-- conversion. The result string may be longer than the input string.
699+-- The result string may be longer than the input string. For
695−-- For instance, the German eszett (U+00DF) maps to the two-letter
700+-- instance, the German eszett (U+00DF) maps to the two-letter
696-- sequence SS.
701-- sequence SS.
697toUpper :: Text -> Text
702toUpper :: Text -> Text
698toUpper t = unstream (S.toUpper (stream t))
703toUpper t = unstream (S.toUpper (stream t))
@@ -700,7 +705,7 @@ toUpper t = unstream (S.toUpper (stream t))
700
705
701
706
702-- | /O(n)/ Convert a string to title case, using simple case
707-- | /O(n)/ Convert a string to title case, using simple case
703−-- conversion.
708+-- conversion. Subject to fusion.
704--
709--
705-- Unlike the other case conversion functions, this function does not
710-- Unlike the other case conversion functions, this function does not
706-- convert every letter of its input. Instead, the first letter is
711-- convert every letter of its input. Instead, the first letter is