path-extensions 0.0.1.0 → 0.1.0.0
raw patch · 5 files changed
+241/−52 lines, 5 filessetup-changed
Files
- ChangeLog.md +8/−1
- LICENSE +1/−1
- Setup.hs +0/−2
- path-extensions.cabal +7/−3
- src/Path/Extensions.hs +225/−45
ChangeLog.md view
@@ -1,3 +1,10 @@ # Changelog for path-extensions -## Unreleased changes+## v0.1.0.0++* Add docstrings.+* Add mp3, py, and svg extensions.++## v0.0.1.0++* Initial addition of various common filepaths and associated functions.
LICENSE view
@@ -1,4 +1,4 @@-Copyright Author name here (c) 2020+Copyright Daniel Firth (c) 2020 All rights reserved.
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
path-extensions.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.2. -- -- see: https://github.com/sol/hpack ----- hash: 165b84035809027d86704f5d9ea0c7783ecd43282e6ca4496010267b23ff5af8+-- hash: 8d9fdedb5be8098c302f2df1cf385e6b885a4a855778349c09057942e825d24b name: path-extensions-version: 0.0.1.0+version: 0.1.0.0 synopsis: Enumeration of common filetype extensions for use with the path library. description: Enumeration of common filetype extensions for use with the path library, add variants for adding an extension to a path and with variants for replacing an existing extension. category: Filesystem@@ -20,6 +20,10 @@ extra-source-files: README.md ChangeLog.md++source-repository head+ type: git+ location: https://gitlab.com/homotopic-tech/path-extensions library exposed-modules:
src/Path/Extensions.hs view
@@ -1,101 +1,281 @@-module Path.Extensions where+module Path.Extensions (+ -- * Raw Extension Strings+ cExtension+, cppExtension+, cssExtension+, gifExtension+, hsExtension+, htmlExtension+, jpgExtension+, jsExtension+, mdExtension+, mp3Extension+, mp4Extension+, oExtension+, pdfExtension+, phpExtension+, pngExtension+, pyExtension+, svgExtension+, xmlExtension -import Control.Monad.Catch-import Path+ -- * Add Extensions+, addCExtension+, addCppExtension+, addCssExtension+, addGifExtension+, addHsExtension+, addHtmlExtension+, addJpgExtension+, addJsExtension+, addMdExtension+, addMp3Extension+, addMp4Extension+, addOExtension+, addPdfExtension+, addPhpExtension+, addPngExtension+, addPyExtension+, addSvgExtension+, addXmlExtension -c_extension = ".c"-cpp_extension = ".cpp"-css_extension = ".css"-gif_extension = ".gif"-hs_extension = ".hs"-html_extension = ".html"-jpg_extension = ".jpg"-js_extension = ".js"-md_extension = ".md"-mp4_extension = ".mp4"-o_extension = ".o"-pdf_extension = ".pdf"-php_extension = ".php"-png_extension = ".png"-xml_extension = ".xml"+ -- * Replace Extensions+, withCExtension+, withCppExtension+, withCssExtension+, withGifExtension+, withHsExtension+, withHtmlExtension+, withJpgExtension+, withJsExtension+, withMdExtension+, withMp3Extension+, withMp4Extension+, withOExtension+, withPdfExtension+, withPhpExtension+, withPngExtension+, withPyExtension+, withSvgExtension+, withXmlExtension+) where +import Control.Monad.Catch+import Data.Text+import Path++-- | The string ".c".+cExtension :: String+cExtension = ".c"++-- | The string ".cpp".+cppExtension :: String+cppExtension = ".cpp"++-- | The string ".css".+cssExtension :: String+cssExtension = ".css"++-- | The string ".gif".+gifExtension :: String+gifExtension = ".gif"++-- | The string ".hs".+hsExtension :: String+hsExtension = ".hs"++-- | The string ".html".+htmlExtension :: String+htmlExtension = ".html"++-- | The string ".jpg".+jpgExtension :: String+jpgExtension = ".jpg"++-- | The string ".js".+jsExtension :: String+jsExtension = ".js"++-- | The string ".md".+mdExtension :: String+mdExtension = ".md"++-- | The string ".mp3".+mp3Extension :: String+mp3Extension = ".mp3"++-- | The string ".mp4".+mp4Extension :: String+mp4Extension = ".mp4"++-- | The string ".o".+oExtension :: String+oExtension = ".o"++-- | The string ".pdf".+pdfExtension :: String+pdfExtension = ".pdf"++-- | The string ".php".+phpExtension :: String+phpExtension = ".php"++-- | The string ".png".+pngExtension :: String+pngExtension = ".png"++-- | The string ".py".+pyExtension :: String+pyExtension = ".py"++-- | The string ".svg"+svgExtension :: String+svgExtension = ".svg"++-- | The string ".xml".+xmlExtension :: String+xmlExtension = ".xml"++-- | Add a ".c" extension to the end of a `File`. addCExtension :: MonadThrow m => Path b File -> m (Path b File)-addCExtension = addExtension c_extension+addCExtension = addExtension cExtension +-- | Add a ".cpp" extension to the end of a `File`. addCppExtension :: MonadThrow m => Path b File -> m (Path b File)-addCppExtension = addExtension cpp_extension+addCppExtension = addExtension cppExtension +-- | Add a ".css" extension to the end of a `File`. addCssExtension :: MonadThrow m => Path b File -> m (Path b File)-addCssExtension = addExtension css_extension+addCssExtension = addExtension cssExtension +-- | Add a ".gif" extension to the end of a `File`. addGifExtension :: MonadThrow m => Path b File -> m (Path b File)-addGifExtension = addExtension c_extension+addGifExtension = addExtension cExtension +-- | Add a ".hs" extension to the end of a `File`. addHsExtension :: MonadThrow m => Path b File -> m (Path b File)-addHsExtension = addExtension gif_extension+addHsExtension = addExtension gifExtension +-- | Add a ".html" extension to the end of a `File`. addHtmlExtension :: MonadThrow m => Path b File -> m (Path b File)-addHtmlExtension = addExtension html_extension+addHtmlExtension = addExtension htmlExtension +-- | Add a ".js" extension to the end of a `File`.+addJsExtension :: MonadThrow m => Path b File -> m (Path b File)+addJsExtension = addExtension jsExtension++-- | Add a ".jpg" extension to the end of a `File`. addJpgExtension :: MonadThrow m => Path b File -> m (Path b File)-addJpgExtension = addExtension jpg_extension+addJpgExtension = addExtension jpgExtension +-- | Add a ".md" extension to the end of a `File`. addMdExtension :: MonadThrow m => Path b File -> m (Path b File)-addMdExtension = addExtension md_extension+addMdExtension = addExtension mdExtension +-- | Add a ".mp3" extension to the end of a `File`.+addMp3Extension :: MonadThrow m => Path b File -> m (Path b File)+addMp3Extension = addExtension mp3Extension++-- | Add a ".mp4" extension to the end of a `File`. addMp4Extension :: MonadThrow m => Path b File -> m (Path b File)-addMp4Extension = addExtension mp4_extension+addMp4Extension = addExtension mp4Extension +-- | Add a ".o" extension to the end of a `File`. addOExtension :: MonadThrow m => Path b File -> m (Path b File)-addOExtension = addExtension o_extension+addOExtension = addExtension oExtension +-- | Add a ".pdf" extension to the end of a `File`. addPdfExtension :: MonadThrow m => Path b File -> m (Path b File)-addPdfExtension = addExtension pdf_extension+addPdfExtension = addExtension pdfExtension +-- | Add a ".php" extension to the end of a `File`. addPhpExtension :: MonadThrow m => Path b File -> m (Path b File)-addPhpExtension = addExtension php_extension+addPhpExtension = addExtension phpExtension +-- | Add a ".png" extension to the end of a `File`. addPngExtension :: MonadThrow m => Path b File -> m (Path b File)-addPngExtension = addExtension png_extension+addPngExtension = addExtension pngExtension +-- | Add a ".py" extension to the end of a `File`.+addPyExtension :: MonadThrow m => Path b File -> m (Path b File)+addPyExtension = addExtension pyExtension++-- | Add a ".svg" extension to the end of a `File`.+addSvgExtension :: MonadThrow m => Path b File -> m (Path b File)+addSvgExtension = addExtension svgExtension++-- | Add a ".xml" extension to the end of a `File`. addXmlExtension :: MonadThrow m => Path b File -> m (Path b File)-addXmlExtension = addExtension xml_extension+addXmlExtension = addExtension xmlExtension +-- | Replace the current extension of a `File` with a ".c" extension. withCExtension :: MonadThrow m => Path b File -> m (Path b File)-withCExtension = replaceExtension c_extension+withCExtension = replaceExtension cExtension +-- | Replace the current extension of a `File` with a ".cpp" extension. withCppExtension :: MonadThrow m => Path b File -> m (Path b File)-withCppExtension = replaceExtension cpp_extension+withCppExtension = replaceExtension cppExtension +-- | Replace the current extension of a `File` with a ".css" extension. withCssExtension :: MonadThrow m => Path b File -> m (Path b File)-withCssExtension = replaceExtension css_extension+withCssExtension = replaceExtension cssExtension +-- | Replace the current extension of a `File` with a ".gif" extension. withGifExtension :: MonadThrow m => Path b File -> m (Path b File)-withGifExtension = replaceExtension gif_extension+withGifExtension = replaceExtension gifExtension +-- | Replace the current extension of a `File` with a ".hs" extension. withHsExtension :: MonadThrow m => Path b File -> m (Path b File)-withHsExtension = replaceExtension hs_extension+withHsExtension = replaceExtension hsExtension +-- | Replace the current extension of a `File` with a ".html" extension. withHtmlExtension :: MonadThrow m => Path b File -> m (Path b File)-withHtmlExtension = replaceExtension html_extension+withHtmlExtension = replaceExtension htmlExtension +-- | Replace the current extension of a `File` with a ".jpg" extension. withJpgExtension :: MonadThrow m => Path b File -> m (Path b File)-withJpgExtension = replaceExtension jpg_extension+withJpgExtension = replaceExtension jpgExtension +-- | Replace the current extension of a `File` with a ".js" extension.+withJsExtension :: MonadThrow m => Path b File -> m (Path b File)+withJsExtension = replaceExtension jsExtension++-- | Replace the current extension of a `File` with a ".md" extension. withMdExtension :: MonadThrow m => Path b File -> m (Path b File)-withMdExtension = replaceExtension md_extension+withMdExtension = replaceExtension mdExtension +-- | Replace the current extension of a `File` with a ".mp3" extension.+withMp3Extension :: MonadThrow m => Path b File -> m (Path b File)+withMp3Extension = replaceExtension mp3Extension++-- | Replace the current extension of a `File` with a ".mp4" extension. withMp4Extension :: MonadThrow m => Path b File -> m (Path b File)-withMp4Extension = replaceExtension mp4_extension+withMp4Extension = replaceExtension mp4Extension +-- | Replace the current extension of a `File` with a ".md" extension.+withOExtension :: MonadThrow m => Path b File -> m (Path b File)+withOExtension = replaceExtension oExtension++-- | Replace the current extension of a `File` with a ".pdf" extension. withPdfExtension :: MonadThrow m => Path b File -> m (Path b File)-withPdfExtension = replaceExtension pdf_extension+withPdfExtension = replaceExtension pdfExtension +-- | Replace the current extension of a `File` with a ".php" extension. withPhpExtension :: MonadThrow m => Path b File -> m (Path b File)-withPhpExtension = replaceExtension php_extension+withPhpExtension = replaceExtension phpExtension +-- | Replace the current extension of a `File` with a ".png" extension. withPngExtension :: MonadThrow m => Path b File -> m (Path b File)-withPngExtension = replaceExtension png_extension+withPngExtension = replaceExtension pngExtension +-- | Replace the current extension of a `File` with a ".py" extension.+withPyExtension :: MonadThrow m => Path b File -> m (Path b File)+withPyExtension = replaceExtension pyExtension++-- | Replace the current extension of a `File` with a ".svg" extension.+withSvgExtension :: MonadThrow m => Path b File -> m (Path b File)+withSvgExtension = replaceExtension svgExtension++-- | Replace the current extension of a `File` with a ".xml" extension. withXmlExtension :: MonadThrow m => Path b File -> m (Path b File)-withXmlExtension = replaceExtension xml_extension+withXmlExtension = replaceExtension xmlExtension