From e6b3fa0f541370b09014ef3095b8a830452cfa2c Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 22 Feb 2024 07:32:10 -1000 Subject: [PATCH] dev:IO: comments --- hledger-lib/Hledger/Utils/IO.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Utils/IO.hs b/hledger-lib/Hledger/Utils/IO.hs index ce5c4cf3c..28309689e 100644 --- a/hledger-lib/Hledger/Utils/IO.hs +++ b/hledger-lib/Hledger/Utils/IO.hs @@ -450,12 +450,13 @@ expandHomePath = \case -- ~username is not supported. Leaves "-" unchanged. Can raise an error. expandPath :: FilePath -> FilePath -> IO FilePath -- general type sig for use in reader parsers expandPath _ "-" = return "-" -expandPath curdir p = (if isRelative p then (curdir ) else id) <$> expandHomePath p +expandPath curdir p = (if isRelative p then (curdir ) else id) <$> expandHomePath p -- PARTIAL: -- | Like expandPath, but treats the expanded path as a glob, and returns -- zero or more matched absolute file paths, alphabetically sorted. +-- Can raise an error. expandGlob :: FilePath -> FilePath -> IO [FilePath] -expandGlob curdir p = expandPath curdir p >>= glob <&> sort +expandGlob curdir p = expandPath curdir p >>= glob <&> sort -- PARTIAL: -- | Given a list of existing file paths, sort them by modification time, most recent first. sortByModTime :: [FilePath] -> IO [FilePath]