Skip to content

Commit 845a282

Browse files
committed
Fix Haddock documentation for forgivingResolve*
Also add missing Haddock documentation
1 parent 246c6cf commit 845a282

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/Path/Extra.hs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,26 @@ pathToLazyByteString = BSL.fromStrict . pathToByteString
130130
pathToByteString :: Path b t -> BS.ByteString
131131
pathToByteString = T.encodeUtf8 . pathToText
132132

133+
-- | Convert to a 'T.Text' type.
133134
pathToText :: Path b t -> T.Text
134135
pathToText = T.pack . toFilePath
135136

137+
-- | Attempt to get the time at which the given file was last modified. Yields
138+
-- `Left ()` if the file does not exist.
139+
--
140+
-- The operation may fail with 'System.IO.Error.isPermissionError' if the user
141+
-- is not permitted to read the modification time.
142+
--
143+
-- Caveat for POSIX systems: This function returns a timestamp with sub-second
144+
-- resolution only if this package is compiled against `unix-2.6.0.0` or later
145+
-- and the underlying filesystem supports them.
136146
tryGetModificationTime :: MonadIO m => Path Abs File -> m (Either () UTCTime)
137147
tryGetModificationTime =
138148
liftIO . tryJust (guard . isDoesNotExistError) . getModificationTime
139149

140150
-- | 'Path.IO.resolveDir' (@path-io@ package) throws 'InvalidAbsDir' (@path@
141-
-- package) if the directory does not exist; this function yields 'Nothing'.
151+
-- package) in certain circumstances; this function yields 'Nothing' in those
152+
-- circumstances.
142153
forgivingResolveDir ::
143154
MonadIO m
144155
=> Path Abs Dir
@@ -156,7 +167,8 @@ forgivingResolveDir b p = liftIO $
156167
)
157168

158169
-- | 'Path.IO.resolveFile' (@path-io@ package) throws 'InvalidAbsFile' (@path@
159-
-- package) if the file does not exist; this function yields 'Nothing'.
170+
-- package) in certain circumstances; this function yields 'Nothing' in those
171+
-- circumstances.
160172
forgivingResolveFile ::
161173
MonadIO m
162174
=> Path Abs Dir
@@ -174,7 +186,8 @@ forgivingResolveFile b p = liftIO $
174186
)
175187

176188
-- | 'Path.IO.resolveFile'' (@path-io@ package) throws 'InvalidAbsFile' (@path@
177-
-- package) if the file does not exist; this function yields 'Nothing'.
189+
-- package) in certain circumstances; this function yields 'Nothing' in those
190+
-- circumstances.
178191
forgivingResolveFile' ::
179192
MonadIO m
180193
=> FilePath

0 commit comments

Comments
 (0)