paths- Library for representing and manipulating type-safe file paths

Safe HaskellUnsafe



This module gives access to internals and operation which can subvert the type-safety of Path.




newtype Path a Source #


A Path is a wrapped FilePath with a type-level tag indicating where this path is rooted (relative to the current directory, absolute path, relative to a web domain, whatever). Most operations on Path are just lifted versions of the operations on the underlying FilePath. The tag however allows us to give a lot of operations a more meaningful type. For instance, it does not make sense to append two absolute paths together; instead, we can only append an unrooted path to another path. It also means we avoid bugs where we use one kind of path where we expect another.


Path FilePath 


Eq (Path a) Source # 


(==) :: Path a -> Path a -> Bool #

(/=) :: Path a -> Path a -> Bool #

Ord (Path a) Source # 


compare :: Path a -> Path a -> Ordering #

(<) :: Path a -> Path a -> Bool #

(<=) :: Path a -> Path a -> Bool #

(>) :: Path a -> Path a -> Bool #

(>=) :: Path a -> Path a -> Bool #

max :: Path a -> Path a -> Path a #

min :: Path a -> Path a -> Path a #

Show (Path a) Source # 


showsPrec :: Int -> Path a -> ShowS #

show :: Path a -> String #

showList :: [Path a] -> ShowS #

NFData (Path a) Source # 


rnf :: Path a -> () #

castRoot :: Path root -> Path root' Source #

Reinterpret the root of a path

This literally just changes the type-level tag; use with caution!

rootPath :: Path Unrooted -> Path root Source #

Reinterpret an unrooted path (UNSAFE)

This is an alias for castRoot; see comments there.