1{-# LANGUAGE BangPatterns #-}
2module Tests.SlowFunctions
8import qualified Data.Text as T
9import Data.Text.Internal (Text(..))
10import Data.Text.Unsafe (iter_, unsafeHead, unsafeTail)
12indices :: T.Text -- ^ Substring to search for (@needle@)
13 -> T.Text -- ^ Text to search in (@haystack@)
15indices needle@(Text _narr _noff nlen) haystack@(Text harr hoff hlen)
19 scan i | i >= hlen = []
20 | needle `T.isPrefixOf` t = i : scan (i+nlen)
21 | otherwise = scan (i+d)
22 where t = Text harr (hoff+i) (hlen-i)
25splitOn :: T.Text -- ^ Text to split on
26 -> T.Text -- ^ Input text
29 | T.null pat = error "splitOn: empty"
30 | l == 1 = T.split (== (unsafeHead pat)) src0
37 | T.null s = [src] -- not found
38 | pat `T.isPrefixOf` s = T.take n src : go (T.drop l s)
39 | otherwise = search (n+1) (unsafeTail s)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list