Extra-1.42: A grab bag of modules.

Extra.Misc

Contents

Synopsis

List functions

String functions

columns :: [[String]] -> [[String]]Source

Pad strings so the columns line up. The argument and return value elements are the rows of a table. Do not pad the rightmost column.

justify :: String -> Int -> [[String]]Source

Group words into lines of length n or less.

Tuple functions

mapSnd :: (b -> c) -> (a, b) -> (a, c)Source

FilePath functions

canon :: FilePath -> FilePathSource

Weak attempt at canonicalizing a file path.

Map and Set functions

listMap :: Ord k => [(k, a)] -> Map k [a]Source

Turn a list of (k, a) pairs into a map from k -> [a]. The order of the elements in the a list is preserved.

listDiff :: Ord a => [a] -> [a] -> [a]Source

Either functions

System.IO functions

System.Posix

checkSuperUser :: IO BoolSource

A version of read with a more helpful error message.

md5sum :: FilePath -> IO (Either String String)Source

Run md5sum on a file and return the resulting checksum as text.

sameInode :: FilePath -> FilePath -> IO BoolSource

Predicate to decide if two files have the same inode.

sameMd5sum :: FilePath -> FilePath -> IO BoolSource

Predicate to decide if two files have the same md5 checksum.

tarDir :: FilePath -> IO (Maybe String)Source

Given a tarball, return the name of the top directory.

Processes

cd :: FilePath -> IO a -> IO aSource

read' :: Read a => String -> aSource