@@ -42,15 +42,17 @@ indices :: Text -- ^ Substring to search for (@needle@)
42indices needle@(Chunk n ns) _haystack@(Chunk k ks)
42indices needle@(Chunk n ns) _haystack@(Chunk k ks)
43 | nlen <= 0 = []
43 | nlen <= 0 = []
44 | nlen == 1 = indicesOne (nindex 0) 0 k ks
44 | nlen == 1 = indicesOne (nindex 0) 0 k ks
45− | otherwise = scan 0 0 k ks
45+ | otherwise = advance k ks 0 0
47− scan !g !i x@(T.Text _ _ l) xs
47+ advance x@(T.Text _ _ l) xs = scan
48 | i >= m = case xs of
50 | i >= m = case xs of
49 Empty -> []
51 Empty -> []
50− Chunk y ys -> scan g (i-m) y ys
52+ Chunk y ys -> advance y ys g (i-m)
51 | lackingHay (i + nlen) x xs = []
53 | lackingHay (i + nlen) x xs = []
52− | c == z && candidateMatch 0 = g : scan (g+nlen) (i+nlen) x xs
54+ | c == z && candidateMatch 0 = g : scan (g+nlen) (i+nlen)
53− | otherwise = scan (g+delta) (i+delta) x xs
55+ | otherwise = scan (g+delta) (i+delta)
55 m = fromIntegral l
57 m = fromIntegral l
56 c = hindex (i + nlast)
58 c = hindex (i + nlast)