uhc-util-0.1.5.0: UHC utilities

Safe HaskellSafe-Inferred
LanguageHaskell98

UHC.Util.Utils

Synopsis

Documentation

unionMapSet :: Ord b => (a -> Set b) -> Set a -> Set b Source

inverseMap :: (Ord k, Ord v') => (k -> v -> (v', k')) -> Map k v -> Map v' k' Source

hdAndTl' :: a -> [a] -> (a, [a]) Source

hdAndTl :: [a] -> (a, [a]) Source

maybeNull :: r -> ([a] -> r) -> [a] -> r Source

maybeHd :: r -> (a -> r) -> [a] -> r Source

wordsBy :: (a -> Bool) -> [a] -> [[a]] Source

initlast :: [a] -> Maybe ([a], a) Source

last' :: a -> [a] -> a Source

variation on last which returns empty value instead of

initlast2 :: [a] -> Maybe ([a], a, a) Source

firstNotEmpty :: [[x]] -> [x] Source

listSaturate :: (Enum a, Ord a) => a -> a -> (x -> a) -> (a -> x) -> [x] -> [x] Source

listSaturateWith :: (Enum a, Ord a) => a -> a -> (x -> a) -> [(a, x)] -> [x] -> [x] Source

spanOnRest :: ([a] -> Bool) -> [a] -> ([a], [a]) Source

tup123to1 :: (t, t1, t2) -> t Source

tup123to2 :: (t, t1, t2) -> t1 Source

tup123to12 :: (t1, t2, t) -> (t1, t2) Source

tup123to23 :: (t, t1, t2) -> (t1, t2) Source

tup12to123 :: t2 -> (t, t1) -> (t, t1, t2) Source

panic :: [Char] -> t Source

isSortedByOn :: (b -> b -> Ordering) -> (a -> b) -> [a] -> Bool Source

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

sortByOn :: (b -> b -> Ordering) -> (a -> b) -> [a] -> [a] Source

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

groupSortOn :: Ord b => (a -> b) -> [a] -> [[a]] Source

groupByOn :: (b -> b -> Bool) -> (a -> b) -> [a] -> [[a]] Source

groupSortByOn :: (b -> b -> Ordering) -> (a -> b) -> [a] -> [[a]] Source

nubOn :: Eq b => (a -> b) -> [a] -> [a] Source

consecutiveBy :: (a -> a -> Bool) -> [a] -> [[a]] Source

The consecutiveBy function groups like groupBy, but based on a function which says whether 2 elements are consecutive

partitionAndRebuild :: (v -> Bool) -> [v] -> ([v], [v], [v'] -> [v'] -> [v']) Source

Partition, but also return a function which will rebuild according to the original ordering of list elements

($?) :: (a -> Maybe b) -> Maybe a -> Maybe b infixr 0 Source

orMb :: Maybe a -> Maybe a -> Maybe a Source

maybeAnd :: x -> (a -> b -> x) -> Maybe a -> Maybe b -> x Source

maybeOr :: x -> (a -> x) -> (b -> x) -> Maybe a -> Maybe b -> x Source

scc :: Ord n => [(n, [n])] -> [[n]] Source

mapLookup2' :: (Ord k1, Ord k2) => (v1 -> Map k2 v2) -> k1 -> k2 -> Map k1 v1 -> Maybe (Map k2 v2, v2) Source

double lookup, with transformer for 2nd map

mapLookup2 :: (Ord k1, Ord k2) => k1 -> k2 -> Map k1 (Map k2 v2) -> Maybe v2 Source

double lookup

firstMaybeM :: Monad m => a -> [a -> m (Maybe a)] -> m a Source

loop over monads yielding a Maybe from a start value, yielding the first Just or the start (when no Just is returned)