fast-tags-2.0.1: Fast incremental vi and emacs tags.
Safe HaskellSafe-Inferred
LanguageHaskell2010

FastTags.Util

Description

Generic utilities.

Synopsis

Documentation

readFileLenient :: FilePath -> IO Text Source #

Read a UTF8 file, but don't crash on encoding errors.

dropBefore :: (a -> Bool) -> [a] -> [a] Source #

Drop until the element before the matching one. Return [] if the function never matches.

sortOn :: Ord k => (a -> k) -> [a] -> [a] Source #

split :: Eq a => a -> [a] -> [[a]] Source #

Split list into chunks delimited by specified element.

mhead :: [a] -> Maybe a Source #

mlast :: [a] -> Maybe a Source #

keyOn :: (a -> k) -> [a] -> [(k, a)] Source #

groupOn :: Eq k => (a -> k) -> [a] -> [[a]] Source #

groupOnKey :: Ord key => (a -> key) -> [a] -> [(key, [a])] Source #

Group the unsorted list into (key x, xs) where all xs compare equal after key is applied to them. List is returned in sorted order.

unique :: Ord a => [a] -> [a] Source #