@@ -125,7 +125,6 @@ module Data.Text
126 , splitTimes
126 , splitTimes
127 , splitTimesEnd
127 , splitTimesEnd
129 , splitWith
128 , splitWith
130 , chunksOf
129 , chunksOf
@@ -882,21 +881,6 @@ tails :: Text -> [Text]
882tails t | null t = [empty]
881tails t | null t = [empty]
883 | otherwise = t : tails (unsafeTail t)
882 | otherwise = t : tails (unsafeTail t)
885−-- | /O(n)/ Break a 'Text' into pieces separated by the 'Char'
886−-- argument, consuming the delimiter. I.e.
888−-- > splitChar '\n' "a\nb\nd\ne" == ["a","b","d","e"]
889−-- > splitChar 'a' "aXaXaXa" == ["","X","X","X",""]
890−-- > splitChar 'x' "x" == ["",""]
894−-- > intercalate (singleton c) . splitChar c == id
895−-- > splitChar == splitWith . (==)
896−splitChar :: Char -> Text -> [Text]
897−splitChar c = splitWith (==c)
898−{-# INLINE splitChar #-}
902-- Splitting functions in this library do not perform character-wise
886-- Splitting functions in this library do not perform character-wise
@@ -918,16 +902,22 @@ split :: Text -- ^ Text to split on
918 -> [Text]
902 -> [Text]
919split pat src0
903split pat src0
920 | l == 0 = [src0]
904 | l == 0 = [src0]
905+ | l == 1 = splitWith (== (head pat)) src0
921 | otherwise = go src0
906 | otherwise = go src0
923− l = length pat
908+ l = length pat
924 go src = search 0 src
909 go src = search 0 src
926 search !n !s
911 search !n !s
927 | null s = [src] -- not found
912 | null s = [src] -- not found
928 | pat `isPrefixOf` s = take n src : go (drop l s)
913 | pat `isPrefixOf` s = take n src : go (drop l s)
929 | otherwise = search (n+1) (unsafeTail s)
914 | otherwise = search (n+1) (unsafeTail s)
930−{-# INLINE split #-}
915+{-# INLINE [1] split #-}
918+"TEXT split/singleton -> splitWith/==" [~1] forall c t.
919+ split (singleton c) t = splitWith (==c) t
932-- | /O(m)*O(n)/ Break a 'Text' into pieces at most @k@ times,
922-- | /O(m)*O(n)/ Break a 'Text' into pieces at most @k@ times,
933-- treating the first 'Text' argument as the delimiter to break on,
923-- treating the first 'Text' argument as the delimiter to break on,