strong-path: Strongly typed paths in Haskell.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Replacement for a FilePath that enables you to handle filepaths in your code in a type-safe manner. You can specify at type level if they are relative, absolute, file, directory, posix, windows, and even to which file/directory they point to or are relative to.


[Skip to Readme]

Properties

Versions 1.0.0, 1.0.0.0, 1.0.1.0, 1.0.1.1, 1.1.0.0, 1.1.1.0, 1.1.2.0, 1.1.3.0, 1.1.4.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), exceptions, filepath, path, template-haskell [details]
License MIT
Copyright 2020 Martin Sosic
Author Martin Sosic
Maintainer sosic.martin@gmail.com
Category System, Filesystem, FilePath
Home page https://github.com/wasp-lang/strong-path#readme
Bug tracker https://github.com/wasp-lang/strong-path/issues
Source repo head: git clone https://github.com/wasp-lang/strong-path
Uploaded by Martinsos at 2021-07-02T16:30:27Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for strong-path-1.0.0

[back to package description]

StrongPath

build status

Strongly typed file paths in Haskell.

This library provides a strongly typed representation of file paths, providing more safety during compile time while also making code more readable, compared to the standard solution (FilePath, which is really just String).

Without StrongPath:

getGitConfigPath :: IO FilePath
generateHtmlFromMarkdown :: FilePath -> IO FilePath

With StrongPath:

getGitConfigPath :: IO (Path System (Rel HomeDir) (File GitConfigFile))
generateHtmlFromMarkdown :: Path System (Rel HomeDir) (File MarkdownFile) -> IO (Path System Abs (File HtmlFile))

Simple but complete example:

import StrongPath (Path, System, Abs, Rel, File, Dir, (</>), parseAbsDir)

data HomeDir

getHomeDirPath :: IO (Path System Abs (Dir HomeDir))
getHomeDirPath = getLine >>= fromJust . parseAbsDir

Check documentation for more details!

Documentation

Detailed documentation, including rich examples and API is written via Haddock. Check out the latest docs on Hackage: Documentation.

You can also build and view the Haddock documentation yourself if you wish, by running stack haddock --open.

Contributing / development

strong-path is Stack project, so make sure you have stack installed on your machine.

stack build to build the project, stack test to run the tests.

stack build --file-watch --haddock to rebuild documentation as you change it.

stack sdist to build publishable .tar.gz.