Safe Haskell | Safe-Inferred |
---|
This module tries to avoid confusing relative, absolute, and canonical
paths at the type level. This is different from the hackage paths
package, because I have Relative to AppDir, and I distinguish Canonical.
I used to have a separate Absolute path, but the conversions get awkward.
Synopsis
- newtype AppDir = AppDir FilePath
- get_app_dir :: IO AppDir
- data Relative
- relative :: Stack.HasCallStack => FilePath -> Relative
- (</>) :: Relative -> Relative -> Relative
- to_absolute :: AppDir -> Relative -> FilePath
- data Canonical
- make_canonical :: FilePath -> Canonical
- canonical :: FilePath -> IO Canonical
- to_path :: Canonical -> FilePath
- drop_prefix :: Canonical -> Canonical -> FilePath
Documentation
get_app_dir :: IO AppDir Source #
All paths should be relative to this one. I may later change this to an env var, a flag, or just leave it hardcoded.
Paths which are intended to be relative to the app dir get this type, so it's harder to accidentally use them directly.
Canonical
This is a path that is absolute and has had all the symlinks squeezed out. The only reason I have this is that I want to strip the global save dir prefix to get a shorter save file name. Save filenames come from the user and likely involve symlinks.
make_canonical :: FilePath -> Canonical Source #
For tests.