Skip to content

Path helpers for my personal projects

License

Notifications You must be signed in to change notification settings

d12frosted/path-extra

Repository files navigation

path-extra

https://github.com/d12frosted/path-extra/workflows/CI/badge.svg

Path helpers for my personal projects. Currently exposes only one module - Path.Parse. Please refer to it for list of all exposed functions. But let me show you two functions which I use the most.

λ> :t parseFilePath
parseFilePath
  :: (MonadThrow m, MonadIO m) => Text -> m (Path Abs File)
λ> parseFilePath "$XDG_CONFIG_HOME/.gitignore"
"/Users/d12frosted/.environment/.gitignore"
λ> :t parseDirPath
parseDirPath
  :: (MonadThrow m, MonadIO m) => Text -> m (Path Abs Dir)
λ> parseDirPath "$XDG_CONFIG_HOME"
"/Users/d12frosted/.environment/"
λ> parseDirPath "$FALSE"
*** Exception: Could not find value of $FALSE in environment.
λ> parseDirPath "~/Developer"
"/Users/d12frosted/Developer/"

Both of them are great for parsing path from user input. Because they expand environment variables and ~/.

At some extent this library was created after CanonicalPath was deprecated. Thanks to Chris Done now we have a better type for path.

Using with stack

Just add path-extra to stack.yaml file.

extra-deps:
- git: https://github.com/d12frosted/path-extra
  commit: 47d59985c7ad939598d35cbe471fe49b930b3484

About

Path helpers for my personal projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published