Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Generic utilities.

## Synopsis

- readFileLenient :: FilePath -> IO Text
- dropBefore :: (a -> Bool) -> [a] -> [a]
- sortOn :: Ord k => (a -> k) -> [a] -> [a]
- split :: Eq a => a -> [a] -> [[a]]
- headt :: Text -> Maybe Char
- mhead :: [a] -> Maybe a
- mlast :: [a] -> Maybe a
- keyOn :: (a -> k) -> [a] -> [(k, a)]
- groupOn :: Eq k => (a -> k) -> [a] -> [[a]]
- groupOnKey :: Ord key => (a -> key) -> [a] -> [(key, [a])]
- isSymbolCharacterCategory :: GeneralCategory -> Bool
- unique :: Ord a => [a] -> [a]

# 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.

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.