File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -312,14 +312,12 @@ hasExtension :: FilePath -> Bool
312
312
hasExtension = any isExtSeparator . takeFileName
313
313
314
314
315
- -- | Drop the given extension from a FilePath, and the \".\" preceding it.
315
+ -- | Drop the given extension from a FilePath, and the @\".\"@ preceding it.
316
+ -- Returns 'Nothing' if the FilePath does not have the given extension, or
317
+ -- 'Just' and the part before the extension if it does.
316
318
--
317
- -- It returns Nothing if the FilePath does not have the extension given, or
318
- -- Just the part before the extension, if it does.
319
- --
320
- -- It is safer to use this function than System.FilePath.dropExtensions,
321
- -- because FilePath might be something like 'file.name.ext1.ext2', where we
322
- -- want to only drop the 'ext1.ext2' part, but keep the full 'file.name' part.
319
+ -- This function can be more predictable than 'dropExtensions', especially if the filename
320
+ -- might itself contain @.@ characters.
323
321
--
324
322
-- > stripExtension "hs.o" "foo.x.hs.o" == Just "foo.x"
325
323
-- > stripExtension "hi.o" "foo.x.hs.o" == Nothing
You can’t perform that action at this time.
0 commit comments