|
|
|
|
|
Description |
Highly random utility functions
|
|
Synopsis |
|
ghciSupported :: Bool | | debugIsOn :: Bool | | ghciTablesNextToCode :: Bool | | picIsOn :: Bool | | isWindowsHost :: Bool | | isWindowsTarget :: Bool | | isDarwinTarget :: Bool | | zipEqual :: String -> [a] -> [b] -> [(a, b)] | | zipWithEqual :: String -> (a -> b -> c) -> [a] -> [b] -> [c] | | zipWith3Equal :: String -> (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] | | zipWith4Equal :: String -> (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e] | | zipLazy :: [a] -> [b] -> [(a, b)] | | stretchZipWith :: (a -> Bool) -> b -> (a -> b -> c) -> [a] -> [b] -> [c] | | unzipWith :: (a -> b -> c) -> [(a, b)] -> [c] | | mapFst :: (a -> c) -> [(a, b)] -> [(c, b)] | | mapSnd :: (b -> c) -> [(a, b)] -> [(a, c)] | | mapAndUnzip :: (a -> (b, c)) -> [a] -> ([b], [c]) | | mapAndUnzip3 :: (a -> (b, c, d)) -> [a] -> ([b], [c], [d]) | | nOfThem :: Int -> a -> [a] | | filterOut :: (a -> Bool) -> [a] -> [a] | | partitionWith :: (a -> Either b c) -> [a] -> ([b], [c]) | | splitEithers :: [Either a b] -> ([a], [b]) | | foldl2 :: (acc -> a -> b -> acc) -> acc -> [a] -> [b] -> acc | | count :: (a -> Bool) -> [a] -> Int | | all2 :: (a -> b -> Bool) -> [a] -> [b] -> Bool | | lengthExceeds :: [a] -> Int -> Bool | | lengthIs :: [a] -> Int -> Bool | | lengthAtLeast :: [a] -> Int -> Bool | | listLengthCmp :: [a] -> Int -> Ordering | | atLength :: ([a] -> b) -> (Int -> b) -> [a] -> Int -> b | | equalLength :: [a] -> [b] -> Bool | | compareLength :: [a] -> [b] -> Ordering | | isSingleton :: [a] -> Bool | | only :: [a] -> a | | singleton :: a -> [a] | | notNull :: [a] -> Bool | | snocView :: [a] -> Maybe ([a], a) | | isn'tIn :: Eq a => String -> a -> [a] -> Bool | | takeList :: [b] -> [a] -> [a] | | dropList :: [b] -> [a] -> [a] | | splitAtList :: [b] -> [a] -> ([a], [a]) | | split :: Char -> String -> [String] | | nTimes :: Int -> (a -> a) -> a -> a | | sortLe :: (a -> a -> Bool) -> [a] -> [a] | | sortWith :: Ord b => (a -> b) -> [a] -> [a] | | on :: (a -> a -> Ordering) -> (b -> a) -> b -> b -> Ordering | | isEqual :: Ordering -> Bool | | eqListBy :: (a -> a -> Bool) -> [a] -> [a] -> Bool | | thenCmp :: Ordering -> Ordering -> Ordering | | cmpList :: (a -> a -> Ordering) -> [a] -> [a] -> Ordering | | maybePrefixMatch :: String -> String -> Maybe String | | removeSpaces :: String -> String | | transitiveClosure :: (a -> [a]) -> (a -> a -> Bool) -> [a] -> [a] | | seqList :: [a] -> b -> b | | looksLikeModuleName :: String -> Bool | | getCmd :: String -> Either String (String, String) | | toCmdArgs :: String -> Either String (String, [String]) | | toArgs :: String -> Either String [String] | | readRational :: String -> Rational | | createDirectoryHierarchy :: FilePath -> IO () | | doesDirNameExist :: FilePath -> IO Bool | | modificationTimeIfExists :: FilePath -> IO (Maybe ClockTime) | | global :: a -> IORef a | | consIORef :: IORef [a] -> a -> IO () | | type Suffix = String | | splitLongestPrefix :: String -> (Char -> Bool) -> (String, String) | | escapeSpaces :: String -> String | | parseSearchPath :: String -> [FilePath] | | | | reslash :: Direction -> FilePath -> FilePath |
|
|
|
Flags dependent on the compiler build
|
|
ghciSupported :: Bool |
|
debugIsOn :: Bool |
|
ghciTablesNextToCode :: Bool |
|
picIsOn :: Bool |
|
isWindowsHost :: Bool |
|
isWindowsTarget :: Bool |
|
isDarwinTarget :: Bool |
|
General list processing
|
|
zipEqual :: String -> [a] -> [b] -> [(a, b)] |
|
zipWithEqual :: String -> (a -> b -> c) -> [a] -> [b] -> [c] |
|
zipWith3Equal :: String -> (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] |
|
zipWith4Equal :: String -> (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e] |
|
zipLazy :: [a] -> [b] -> [(a, b)] |
zipLazy is a kind of zip that is lazy in the second list (observe the ~)
|
|
stretchZipWith :: (a -> Bool) -> b -> (a -> b -> c) -> [a] -> [b] -> [c] |
stretchZipWith p z f xs ys stretches ys by inserting z in
the places where p returns True
|
|
unzipWith :: (a -> b -> c) -> [(a, b)] -> [c] |
|
mapFst :: (a -> c) -> [(a, b)] -> [(c, b)] |
|
mapSnd :: (b -> c) -> [(a, b)] -> [(a, c)] |
|
mapAndUnzip :: (a -> (b, c)) -> [a] -> ([b], [c]) |
|
mapAndUnzip3 :: (a -> (b, c, d)) -> [a] -> ([b], [c], [d]) |
|
nOfThem :: Int -> a -> [a] |
|
filterOut :: (a -> Bool) -> [a] -> [a] |
Like filter, only it reverses the sense of the test
|
|
partitionWith :: (a -> Either b c) -> [a] -> ([b], [c]) |
Uses a function to determine which of two output lists an input element should join
|
|
splitEithers :: [Either a b] -> ([a], [b]) |
Teases a list of Eithers apart into two lists
|
|
foldl2 :: (acc -> a -> b -> acc) -> acc -> [a] -> [b] -> acc |
|
count :: (a -> Bool) -> [a] -> Int |
|
all2 :: (a -> b -> Bool) -> [a] -> [b] -> Bool |
|
lengthExceeds :: [a] -> Int -> Bool |
(lengthExceeds xs n) = (length xs > n)
|
|
lengthIs :: [a] -> Int -> Bool |
|
lengthAtLeast :: [a] -> Int -> Bool |
|
listLengthCmp :: [a] -> Int -> Ordering |
|
atLength :: ([a] -> b) -> (Int -> b) -> [a] -> Int -> b |
atLength atLen atEnd ls n unravels list ls to position n. Precisely:
atLength atLenPred atEndPred ls n
| n < 0 = atLenPred n
| length ls < n = atEndPred (n - length ls)
| otherwise = atLenPred (drop n ls)
|
|
equalLength :: [a] -> [b] -> Bool |
|
compareLength :: [a] -> [b] -> Ordering |
|
isSingleton :: [a] -> Bool |
|
only :: [a] -> a |
|
singleton :: a -> [a] |
|
notNull :: [a] -> Bool |
|
snocView :: [a] -> Maybe ([a], a) |
|
isn'tIn :: Eq a => String -> a -> [a] -> Bool |
|
List operations controlled by another list
|
|
takeList :: [b] -> [a] -> [a] |
|
dropList :: [b] -> [a] -> [a] |
|
splitAtList :: [b] -> [a] -> ([a], [a]) |
|
split :: Char -> String -> [String] |
|
For loop
|
|
nTimes :: Int -> (a -> a) -> a -> a |
Compose a function with itself n times. (nth rather than twice)
|
|
Sorting
|
|
sortLe :: (a -> a -> Bool) -> [a] -> [a] |
|
sortWith :: Ord b => (a -> b) -> [a] -> [a] |
|
on :: (a -> a -> Ordering) -> (b -> a) -> b -> b -> Ordering |
|
Comparisons
|
|
isEqual :: Ordering -> Bool |
|
eqListBy :: (a -> a -> Bool) -> [a] -> [a] -> Bool |
|
thenCmp :: Ordering -> Ordering -> Ordering |
|
cmpList :: (a -> a -> Ordering) -> [a] -> [a] -> Ordering |
|
maybePrefixMatch :: String -> String -> Maybe String |
|
removeSpaces :: String -> String |
|
Transitive closures
|
|
transitiveClosure :: (a -> [a]) -> (a -> a -> Bool) -> [a] -> [a] |
|
Strictness
|
|
seqList :: [a] -> b -> b |
|
Module names
|
|
looksLikeModuleName :: String -> Bool |
|
Argument processing
|
|
getCmd :: String -> Either String (String, String) |
|
toCmdArgs :: String -> Either String (String, [String]) |
|
toArgs :: String -> Either String [String] |
|
Floating point
|
|
readRational :: String -> Rational |
|
IO-ish utilities
|
|
createDirectoryHierarchy :: FilePath -> IO () |
|
doesDirNameExist :: FilePath -> IO Bool |
|
modificationTimeIfExists :: FilePath -> IO (Maybe ClockTime) |
|
global :: a -> IORef a |
|
consIORef :: IORef [a] -> a -> IO () |
|
Filenames and paths
|
|
type Suffix = String |
|
splitLongestPrefix :: String -> (Char -> Bool) -> (String, String) |
|
escapeSpaces :: String -> String |
|
parseSearchPath :: String -> [FilePath] |
The function splits the given string to substrings
using the searchPathSeparator.
|
|
data Direction |
|
|
reslash :: Direction -> FilePath -> FilePath |
|
Produced by Haddock version 2.3.0 |