Safe Haskell | None |
---|---|
Language | Haskell2010 |
Standard imports and utilities which are useful everywhere, or needed low in the module hierarchy. This is the bottom of hledger's module graph.
- lowercase :: String -> String
- uppercase :: String -> String
- strip :: String -> String
- lstrip :: String -> String
- rstrip :: String -> String
- chomp :: String -> String
- stripbrackets :: String -> String
- elideLeft :: Int -> String -> String
- elideRight :: Int -> String -> String
- underline :: String -> String
- quoteIfSpaced :: String -> String
- quoteIfNeeded :: String -> String
- singleQuoteIfNeeded :: String -> String
- quotechars :: [Char]
- whitespacechars :: [Char]
- escapeDoubleQuotes :: String -> String
- escapeSingleQuotes :: String -> String
- escapeQuotes :: String -> String
- words' :: String -> [String]
- unwords' :: [String] -> String
- stripquotes :: String -> String
- isSingleQuoted :: [Char] -> Bool
- isDoubleQuoted :: [Char] -> Bool
- unbracket :: String -> String
- concatTopPadded :: [String] -> String
- concatBottomPadded :: [String] -> String
- vConcatRightAligned :: [String] -> String
- padtop :: Int -> String -> String
- padbottom :: Int -> String -> String
- padleft :: Int -> String -> String
- padright :: Int -> String -> String
- cliptopleft :: Int -> Int -> String -> String
- fitto :: Int -> Int -> String -> String
- first3 :: (t, t1, t2) -> t
- second3 :: (t, t1, t2) -> t1
- third3 :: (t, t1, t2) -> t2
- first4 :: (t, t1, t2, t3) -> t
- second4 :: (t, t1, t2, t3) -> t1
- third4 :: (t, t1, t2, t3) -> t2
- fourth4 :: (t, t1, t2, t3) -> t3
- first5 :: (t, t1, t2, t3, t4) -> t
- second5 :: (t, t1, t2, t3, t4) -> t1
- third5 :: (t, t1, t2, t3, t4) -> t2
- fourth5 :: (t, t1, t2, t3, t4) -> t3
- fifth5 :: (t, t1, t2, t3, t4) -> t4
- difforzero :: (Num a, Ord a) => a -> a -> a
- splitAtElement :: Eq a => a -> [a] -> [[a]]
- root :: Tree a -> a
- subs :: Tree a -> Forest a
- branches :: Tree a -> Forest a
- leaves :: Tree a -> [a]
- subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a)
- subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a)
- treeprune :: Int -> Tree a -> Tree a
- treemap :: (a -> b) -> Tree a -> Tree b
- treefilter :: (a -> Bool) -> Tree a -> Tree a
- treeany :: (a -> Bool) -> Tree a -> Bool
- showtree :: Show a => Tree a -> String
- showforest :: Show a => Forest a -> String
- newtype FastTree a = T (Map a (FastTree a))
- emptyTree :: FastTree a
- mergeTrees :: Ord a => FastTree a -> FastTree a -> FastTree a
- treeFromPath :: [a] -> FastTree a
- treeFromPaths :: Ord a => [[a]] -> FastTree a
- choice' :: Stream s m t => [ParsecT s u m a] -> ParsecT s u m a
- parsewith :: Parsec [Char] () a -> String -> Either ParseError a
- parseWithCtx :: Stream s m t => u -> ParsecT s u m a -> s -> m (Either ParseError a)
- fromparse :: Either ParseError a -> a
- parseerror :: ParseError -> a
- showParseError :: ParseError -> String
- showDateParseError :: ParseError -> String
- nonspace :: Stream [Char] m Char => ParsecT [Char] st m Char
- spacenonewline :: Stream [Char] m Char => ParsecT [Char] st m Char
- restofline :: Stream [Char] m Char => ParsecT [Char] st m String
- eolof :: Stream [Char] m Char => ParsecT [Char] st m ()
- getCurrentLocalTime :: IO LocalTime
- testName :: Test -> String
- flattenTests :: Test -> [Test]
- filterTests :: (Test -> Bool) -> Test -> Test
- is :: (Eq a, Show a) => a -> a -> Assertion
- assertParse :: Either ParseError a -> Assertion
- assertParseFailure :: Either ParseError a -> Assertion
- assertParseEqual :: (Show a, Eq a) => Either ParseError a -> a -> Assertion
- printParseError :: Show a => a -> IO ()
- isLeft :: Either a b -> Bool
- isRight :: Either a b -> Bool
- applyN :: Int -> (a -> a) -> a -> a
- expandPath :: MonadIO m => FilePath -> FilePath -> m FilePath
- firstJust :: Eq a => [Maybe a] -> Maybe a
- readFile' :: FilePath -> IO String
- module Hledger.Utils.Debug
- module Hledger.Utils.Regex
- type SystemString = String
- fromSystemString :: SystemString -> String
- toSystemString :: String -> SystemString
- error' :: String -> a
- userError' :: String -> IOError
Documentation
stripbrackets :: String -> String Source
elideRight :: Int -> String -> String Source
quoteIfSpaced :: String -> String Source
Wrap a string in double quotes, and -prefix any embedded single quotes, if it contains whitespace and is not already single- or double-quoted.
quoteIfNeeded :: String -> String Source
Double-quote this string if it contains whitespace, single quotes or double-quotes, escaping the quotes as needed.
singleQuoteIfNeeded :: String -> String Source
Single-quote this string if it contains whitespace or double-quotes. No good for strings containing single quotes.
quotechars :: [Char] Source
whitespacechars :: [Char] Source
escapeDoubleQuotes :: String -> String Source
escapeSingleQuotes :: String -> String Source
escapeQuotes :: String -> String Source
words' :: String -> [String] Source
Quote-aware version of words - don't split on spaces which are inside quotes. NB correctly handles "a'b" but not "''a''". Can raise an error if parsing fails.
unwords' :: [String] -> String Source
Quote-aware version of unwords - single-quote strings which contain whitespace
stripquotes :: String -> String Source
Strip one matching pair of single or double quotes on the ends of a string.
isSingleQuoted :: [Char] -> Bool Source
isDoubleQuoted :: [Char] -> Bool Source
concatTopPadded :: [String] -> String Source
Join multi-line strings as side-by-side rectangular strings of the same height, top-padded.
concatBottomPadded :: [String] -> String Source
Join multi-line strings as side-by-side rectangular strings of the same height, bottom-padded.
vConcatRightAligned :: [String] -> String Source
Compose strings vertically and right-aligned.
padtop :: Int -> String -> String Source
Convert a multi-line string to a rectangular string top-padded to the specified height.
padbottom :: Int -> String -> String Source
Convert a multi-line string to a rectangular string bottom-padded to the specified height.
padleft :: Int -> String -> String Source
Convert a multi-line string to a rectangular string left-padded to the specified width.
padright :: Int -> String -> String Source
Convert a multi-line string to a rectangular string right-padded to the specified width.
cliptopleft :: Int -> Int -> String -> String Source
Clip a multi-line string to the specified width and height from the top left.
fitto :: Int -> Int -> String -> String Source
Clip and pad a multi-line string to fill the specified width and height.
difforzero :: (Num a, Ord a) => a -> a -> a Source
splitAtElement :: Eq a => a -> [a] -> [[a]] Source
subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a) Source
get the sub-tree rooted at the first (left-most, depth-first) occurrence of the specified node value
subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a) Source
get the sub-tree for the specified node value in the first tree in forest in which it occurs.
treefilter :: (a -> Bool) -> Tree a -> Tree a Source
remove all subtrees whose nodes do not fulfill predicate
showforest :: Show a => Forest a -> String Source
show a compact ascii representation of a forest
An efficient-to-build tree suggested by Cale Gibbard, probably better than accountNameTreeFrom.
treeFromPath :: [a] -> FastTree a Source
treeFromPaths :: Ord a => [[a]] -> FastTree a Source
choice' :: Stream s m t => [ParsecT s u m a] -> ParsecT s u m a Source
Backtracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail.
parseWithCtx :: Stream s m t => u -> ParsecT s u m a -> s -> m (Either ParseError a) Source
fromparse :: Either ParseError a -> a Source
parseerror :: ParseError -> a Source
showParseError :: ParseError -> String Source
flattenTests :: Test -> [Test] Source
Flatten a Test containing TestLists into a list of single tests.
filterTests :: (Test -> Bool) -> Test -> Test Source
Filter TestLists in a Test, recursively, preserving the structure.
is :: (Eq a, Show a) => a -> a -> Assertion Source
Simple way to assert something is some expected value, with no label.
assertParse :: Either ParseError a -> Assertion Source
Assert a parse result is successful, printing the parse error on failure.
assertParseFailure :: Either ParseError a -> Assertion Source
Assert a parse result is successful, printing the parse error on failure.
assertParseEqual :: (Show a, Eq a) => Either ParseError a -> a -> Assertion Source
Assert a parse result is some expected value, printing the parse error on failure.
printParseError :: Show a => a -> IO () Source
applyN :: Int -> (a -> a) -> a -> a Source
Apply a function the specified number of times. Possibly uses O(n) stack ?
expandPath :: MonadIO m => FilePath -> FilePath -> m FilePath Source
Convert a possibly relative, possibly tilde-containing file path to an absolute one, given the current directory. ~username is not supported. Leave "-" unchanged.
readFile' :: FilePath -> IO String Source
Read a file in universal newline mode, handling whatever newline convention it may contain.
module Hledger.Utils.Debug
module Hledger.Utils.Regex
type SystemString = String Source
A string received from or being passed to the operating system, such as a file path, command-line argument, or environment variable name or value. With GHC versions before 7.2 on some platforms (posix) these are typically encoded. When converting, we assume the encoding is UTF-8 (cf http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html#UTF8).
fromSystemString :: SystemString -> String Source
Convert a system string to an ordinary string, decoding from UTF-8 if it appears to be UTF8-encoded and GHC version is less than 7.2.
toSystemString :: String -> SystemString Source
Convert a unicode string to a system string, encoding with UTF-8 if we are on a posix platform with GHC < 7.2.
userError' :: String -> IOError Source
A SystemString-aware version of userError.