@@ -125,7 +125,6 @@ module Data.Text
125125 , split
126126 , splitTimes
127127 , splitTimesEnd
128− , splitChar
129128 , splitWith
130129 , chunksOf
131130
@@ -882,21 +881,6 @@ tails :: Text -> [Text]
882881tails t | null t = [empty]
883882 | otherwise = t : tails (unsafeTail t)
884883
885−-- | /O(n)/ Break a 'Text' into pieces separated by the 'Char'
886−-- argument, consuming the delimiter. I.e.
887−--
888−-- > splitChar '\n' "a\nb\nd\ne" == ["a","b","d","e"]
889−-- > splitChar 'a' "aXaXaXa" == ["","X","X","X",""]
890−-- > splitChar 'x' "x" == ["",""]
891−--
892−-- and
893−--
894−-- > intercalate (singleton c) . splitChar c == id
895−-- > splitChar == splitWith . (==)
896−splitChar :: Char -> Text -> [Text]
897−splitChar c = splitWith (==c)
898−{-# INLINE splitChar #-}
899−
900884-- $split
901885--
902886-- Splitting functions in this library do not perform character-wise
@@ -918,16 +902,22 @@ split :: Text -- ^ Text to split on
918902 -> [Text]
919903split pat src0
920904 | l == 0 = [src0]
905+ | l == 1 = splitWith (== (head pat)) src0
921906 | otherwise = go src0
922907 where
923− l = length pat
908+ l = length pat
924909 go src = search 0 src
925910 where
926911 search !n !s
927912 | null s = [src] -- not found
928913 | pat `isPrefixOf` s = take n src : go (drop l s)
929914 | otherwise = search (n+1) (unsafeTail s)
930−{-# INLINE split #-}
915+{-# INLINE [1] split #-}
916+
917+{-# RULES
918+"TEXT split/singleton -> splitWith/==" [~1] forall c t.
919+ split (singleton c) t = splitWith (==c) t
920+ #-}
931921
932922-- | /O(m)*O(n)/ Break a 'Text' into pieces at most @k@ times,
933923-- treating the first 'Text' argument as the delimiter to break on,