1{-# LANGUAGE BangPatterns #-}
9import qualified Data.Text as T
10import Data.Text.Internal (Text(..))
11import Data.Text.Unsafe (iter_, unsafeHead, unsafeTail)
13indices :: T.Text -- ^ Substring to search for (@needle@)
14 -> T.Text -- ^ Text to search in (@haystack@)
16indices needle@(Text _narr _noff nlen) haystack@(Text harr hoff hlen)
20 scan i | i >= hlen = []
21 | needle `T.isPrefixOf` t = i : scan (i+nlen)
22 | otherwise = scan (i+d)
23 where t = Text harr (hoff+i) (hlen-i)
26splitOn :: T.Text -- ^ Text to split on
27 -> T.Text -- ^ Input text
30 | T.null pat = error "splitOn: empty"
31 | l == 1 = T.split (== (unsafeHead pat)) src0
38 | T.null s = [src] -- not found
39 | pat `T.isPrefixOf` s = T.take n src : go (T.drop l s)
40 | 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