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

Safe HaskellNone
LanguageHaskell2010

Hledger.Utils

Contents

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 :: (a, b, c) -> a Source #

second3 :: (a, b, c) -> b Source #

third3 :: (a, b, c) -> c Source #

first4 :: (a, b, c, d) -> a Source #

second4 :: (a, b, c, d) -> b Source #

third4 :: (a, b, c, d) -> c Source #

fourth4 :: (a, b, c, d) -> d Source #

first5 :: (a, b, c, d, e) -> a Source #

second5 :: (a, b, c, d, e) -> b Source #

third5 :: (a, b, c, d, e) -> c Source #

fourth5 :: (a, b, c, d, e) -> d Source #

fifth5 :: (a, b, c, d, e) -> e Source #

first6 :: (a, b, c, d, e, f) -> a Source #

second6 :: (a, b, c, d, e, f) -> b Source #

third6 :: (a, b, c, d, e, f) -> c Source #

fourth6 :: (a, b, c, d, e, f) -> d Source #

fifth6 :: (a, b, c, d, e, f) -> e Source #

sixth6 :: (a, b, c, d, e, f) -> f Source #

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

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

Apply a function the specified number of times, which should be > 0 (otherwise does nothing). 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.

expandHomePath :: FilePath -> IO FilePath Source #

Expand user home path indicated by tilde prefix

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

readFilePortably :: FilePath -> IO Text Source #

Read text from a file, handling any of the usual line ending conventions, using the system locale's text encoding, ignoring any utf8 BOM prefix (as seen in paypal's 2018 CSV, eg) if that encoding is utf8.

readFileOrStdinPortably :: String -> IO Text Source #

Like readFilePortably, but read from standard input if the path is "-".

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

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

sumStrict :: Num a => [a] -> a Source #

Strict version of sum that doesn’t leak space

maximumStrict :: Ord a => [a] -> a Source #

Strict version of maximum that doesn’t leak space

minimumStrict :: Ord a => [a] -> a Source #

Strict version of minimum that doesn’t leak space

sequence' :: Monad f => [f a] -> f [a] Source #

This is a version of sequence based on difference lists. It is slightly faster but we mostly use it because it uses the heap instead of the stack. This has the advantage that Neil Mitchell’s trick of limiting the stack size to discover space leaks doesn’t show this as a false positive.

mapM' :: Monad f => (a -> f b) -> [a] -> f [b] Source #

Like mapM but uses sequence'.

embedFileRelative :: FilePath -> Q Exp Source #

Like embedFile, but takes a path relative to the package directory. Similar to embedFileRelative ?

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.

usageError :: String -> a Source #

A SystemString-aware version of error that adds a usage hint.

Orphan instances

Default Bool Source # 
Instance details

Methods

def :: Bool #