hledger-lib-1.0: Core data types, parsers and functionality for the hledger accounting tools

Safe HaskellNone
LanguageHaskell2010

Hledger.Utils

Description

Standard imports and utilities which are useful everywhere, or needed low in the module hierarchy. This is the bottom of hledger's module graph.

Synopsis

Documentation

first3 :: (t2, t1, t) -> t2 Source #

second3 :: (t1, t2, t) -> t2 Source #

third3 :: (t1, t, t2) -> t2 Source #

first4 :: (t3, t2, t1, t) -> t3 Source #

second4 :: (t2, t3, t1, t) -> t3 Source #

third4 :: (t2, t1, t3, t) -> t3 Source #

fourth4 :: (t2, t1, t, t3) -> t3 Source #

first5 :: (t4, t3, t2, t1, t) -> t4 Source #

second5 :: (t3, t4, t2, t1, t) -> t4 Source #

third5 :: (t3, t2, t4, t1, t) -> t4 Source #

fourth5 :: (t3, t2, t1, t4, t) -> t4 Source #

fifth5 :: (t3, t2, t1, t, t4) -> t4 Source #

first6 :: (t5, t4, t3, t2, t1, t) -> t5 Source #

second6 :: (t4, t5, t3, t2, t1, t) -> t5 Source #

third6 :: (t4, t3, t5, t2, t1, t) -> t5 Source #

fourth6 :: (t4, t3, t2, t5, t1, t) -> t5 Source #

fifth6 :: (t4, t3, t2, t1, t5, t) -> t5 Source #

sixth6 :: (t4, t3, t2, t1, t, t5) -> t5 Source #

splitAtElement :: Eq a => a -> [a] -> [[a]] Source #

applyN :: Int -> (a -> a) -> a -> a Source #

Apply a function the specified number of times. Possibly uses O(n) stack ?

expandPath :: FilePath -> FilePath -> IO 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. Can raise an error.

firstJust :: Eq a => [Maybe a] -> Maybe a Source #

readFile' :: FilePath -> IO Text Source #

Read a file in universal newline mode, handling any of the usual line ending conventions.

readFileAnyLineEnding :: FilePath -> IO Text Source #

Read a file in universal newline mode, handling any of the usual line ending conventions.

readFileOrStdinAnyLineEnding :: String -> IO Text Source #

Read the given file, or standard input if the path is "-", using universal newline mode.

maximum' :: Integral a => [a] -> a Source #

Total version of maximum, for integral types, giving 0 for an empty list.

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.

error' :: String -> a Source #

A SystemString-aware version of error.

userError' :: String -> IOError Source #

A SystemString-aware version of userError.