hbc-library-0.17: HBC library

Safe HaskellSafe-Inferred

ListUtil

Synopsis

Documentation

unfoldr :: (a -> (b, a)) -> (a -> Bool) -> a -> [b]

Repeatedly extract (and transform) values until a predicate hold. Return the list of values.

chopList :: ([a] -> (b, [a])) -> [a] -> [b]

breakAt :: Eq a => a -> [a] -> ([a], [a])

readListLazily :: Read a => String -> [a]

Read a list lazily (in contrast with reads which requires to see the ']' before returning the list.

mapFst :: (t -> t1) -> [(t, t2)] -> [(t1, t2)]

mapSnd :: (t -> t2) -> [(t1, t)] -> [(t1, t2)]

assoc :: Eq c => (a -> b) -> b -> [(c, a)] -> c -> b

Lookup an item in an association list. Apply a function to it if it is found, otherwise return a default value.