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

Safe HaskellUnsafe
LanguageHaskell2010

System.Path.Unsafe

Description

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

Since: 0.2.0.0

Synopsis

Documentation

newtype Path a Source #

Paths

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.

Constructors

Path FilePath 

Instances

Eq (Path a) Source # 

Methods

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

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

Ord (Path a) Source # 

Methods

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 # 

Methods

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

show :: Path a -> String #

showList :: [Path a] -> ShowS #

NFData (Path a) Source # 

Methods

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.