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.
Synopsis
- first3 :: (a, b, c) -> a
- second3 :: (a, b, c) -> b
- third3 :: (a, b, c) -> c
- first4 :: (a, b, c, d) -> a
- second4 :: (a, b, c, d) -> b
- third4 :: (a, b, c, d) -> c
- fourth4 :: (a, b, c, d) -> d
- first5 :: (a, b, c, d, e) -> a
- second5 :: (a, b, c, d, e) -> b
- third5 :: (a, b, c, d, e) -> c
- fourth5 :: (a, b, c, d, e) -> d
- fifth5 :: (a, b, c, d, e) -> e
- first6 :: (a, b, c, d, e, f) -> a
- second6 :: (a, b, c, d, e, f) -> b
- third6 :: (a, b, c, d, e, f) -> c
- fourth6 :: (a, b, c, d, e, f) -> d
- fifth6 :: (a, b, c, d, e, f) -> e
- sixth6 :: (a, b, c, d, e, f) -> f
- curry2 :: ((a, b) -> c) -> a -> b -> c
- uncurry2 :: (a -> b -> c) -> (a, b) -> c
- curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
- uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
- curry4 :: ((a, b, c, d) -> e) -> a -> b -> c -> d -> e
- uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e
- splitAtElement :: Eq a => a -> [a] -> [[a]]
- getCurrentLocalTime :: IO LocalTime
- getCurrentZonedTime :: IO ZonedTime
- isLeft :: Either a b -> Bool
- isRight :: Either a b -> Bool
- applyN :: Int -> (a -> a) -> a -> a
- expandPath :: FilePath -> FilePath -> IO FilePath
- expandHomePath :: FilePath -> IO FilePath
- firstJust :: Eq a => [Maybe a] -> Maybe a
- readFilePortably :: FilePath -> IO Text
- readFileOrStdinPortably :: String -> IO Text
- readHandlePortably :: Handle -> IO Text
- maximum' :: Integral a => [a] -> a
- sumStrict :: Num a => [a] -> a
- maximumStrict :: Ord a => [a] -> a
- minimumStrict :: Ord a => [a] -> a
- sequence' :: Monad f => [f a] -> f [a]
- mapM' :: Monad f => (a -> f b) -> [a] -> f [b]
- embedFileRelative :: FilePath -> Q Exp
- tests_Utils :: TestTree
- module Hledger.Utils.Debug
- module Hledger.Utils.Parse
- module Hledger.Utils.Regex
- module Hledger.Utils.String
- module Hledger.Utils.Text
- module Hledger.Utils.Test
- module Hledger.Utils.Color
- module Hledger.Utils.Tree
- error' :: String -> a
- userError' :: String -> IOError
- usageError :: String -> a
Documentation
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.
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.
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.
embedFileRelative :: FilePath -> Q Exp Source #
Like embedFile, but takes a path relative to the package directory. Similar to embedFileRelative ?
module Hledger.Utils.Debug
module Hledger.Utils.Parse
module Hledger.Utils.Regex
module Hledger.Utils.String
module Hledger.Utils.Text
module Hledger.Utils.Test
module Hledger.Utils.Color
module Hledger.Utils.Tree
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.