uhc-util-0.1.7.0: UHC utilities

Safe HaskellSafe
LanguageHaskell98

UHC.Util.FPath

Contents

Description

Library for manipulating a more structured version of FilePath. Note: the library should use System.FilePath functionality but does not do so yet.

Synopsis

FPath datatype, FPATH class for overloaded construction

data FPath Source #

File path representation making explicit (possible) directory, base and (possible) suffix

Constructors

FPath 

Instances

Eq FPath Source # 

Methods

(==) :: FPath -> FPath -> Bool #

(/=) :: FPath -> FPath -> Bool #

Ord FPath Source # 

Methods

compare :: FPath -> FPath -> Ordering #

(<) :: FPath -> FPath -> Bool #

(<=) :: FPath -> FPath -> Bool #

(>) :: FPath -> FPath -> Bool #

(>=) :: FPath -> FPath -> Bool #

max :: FPath -> FPath -> FPath #

min :: FPath -> FPath -> FPath #

Show FPath Source # 

Methods

showsPrec :: Int -> FPath -> ShowS #

show :: FPath -> String #

showList :: [FPath] -> ShowS #

Generic FPath Source # 

Associated Types

type Rep FPath :: * -> * #

Methods

from :: FPath -> Rep FPath x #

to :: Rep FPath x -> FPath #

FPATH FPath Source # 

Methods

mkFPath :: FPath -> FPath Source #

type Rep FPath Source # 
type Rep FPath = D1 * (MetaData "FPath" "UHC.Util.FPath" "uhc-util-0.1.7.0-LlgAx2NqjXTFCDHb7Mrp2c" False) (C1 * (MetaCons "FPath" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "fpathMbDir") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe FilePath))) ((:*:) * (S1 * (MetaSel (Just Symbol "fpathBase") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * String)) (S1 * (MetaSel (Just Symbol "fpathMbSuff") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe String))))))

fpathSuff :: FPath -> String Source #

Get suffix, being empty equals the empty String

class FPATH f where Source #

Construct a FPath from some type

Minimal complete definition

mkFPath

Methods

mkFPath :: f -> FPath Source #

class FPathError e Source #

Is error related to FPath

emptyFPath :: FPath Source #

Empty FPath

Construction, deconstruction, predicates

fpathFromStr :: FilePath -> FPath Source #

Construct FPath from FilePath

mkFPathFromDirsFile :: Show s => [s] -> s -> FPath Source #

fpathToStr :: FPath -> FilePath Source #

Conversion to FilePath

fpathIsEmpty :: FPath -> Bool Source #

Is FPath empty?

fpathSetBase :: String -> FPath -> FPath Source #

Set the base

fpathSetSuff :: String -> FPath -> FPath Source #

Set suffix, empty String removes it

fpathSetDir :: FilePath -> FPath -> FPath Source #

Set directory, empty FilePath removes it

fpathUpdBase :: (String -> String) -> FPath -> FPath Source #

Modify the base

fpathRemoveSuff :: FPath -> FPath Source #

Remove suffix

fpathAppendDir :: FPath -> FilePath -> FPath Source #

Append directory (to directory part)

fpathUnAppendDir :: FPath -> FilePath -> FPath Source #

Remove common trailing part of dir. Note: does not check whether it really is a suffix.

fpathPrependDir :: FilePath -> FPath -> FPath Source #

Prepend directory

fpathUnPrependDir :: FilePath -> FPath -> FPath Source #

Remove directory (prefix), using fpathSplitDirBy

fpathSplitDirBy :: FilePath -> FPath -> Maybe (String, String) Source #

Split FPath into given directory (prefix) and remainder, fails if not a prefix

mkTopLevelFPath Source #

Arguments

:: String

suffix

-> FilePath

file name

-> FPath 

Make FPath from FilePath, setting the suffix when absent

SearchPath

type FileSuffixesWith x = [FileSuffixWith x] Source #

FileSuffix with extra payload

type FileSuffixWith x = (Maybe String, x) Source #

FileSuffix with extra payload

searchLocationsForReadableFilesWith Source #

Arguments

:: (loc -> FPath -> [(loc, FPath, [e])])

get the locations for a name, possibly with errors

-> Bool

stop when first is found

-> [loc]

locations to search

-> FileSuffixesWith s

suffixes to try, with associated info

-> FPath

search for a path

-> IO [(FPath, loc, s, [e])] 

Search for file in locations, with possible suffices

searchLocationsForReadableFiles Source #

Arguments

:: (loc -> FPath -> [(loc, FPath, [e])])

get the locations for a name, possibly with errors

-> Bool

stop when first is found

-> [loc]

locations to search

-> FileSuffixes

suffixes to try

-> FPath

search for a path

-> IO [(FPath, loc, [e])] 

Search for file in locations, with possible suffices

Path as prefix

filePathMkPrefix :: FilePath -> FilePath Source #

Construct a filepath to be a prefix (i.e. ending with / as last char)

filePathUnPrefix :: FilePath -> FilePath Source #

Remove from a filepath a possibly present / as last char

filePathCoalesceSeparator :: FilePath -> FilePath Source #

Remove consecutive occurrences of /

filePathMkAbsolute :: FilePath -> FilePath Source #

Make a filepath an absolute filepath by prefixing with /

filePathUnAbsolute :: FilePath -> FilePath Source #

Make a filepath an relative filepath by removing prefixed /-s

Misc