effects-unix-compat-0.1: Unix-compat effects
Safe HaskellNone
LanguageGHC2021

Effects.System.PosixCompat

Description

Provides the MonadPosixCompat typeclass.

Since: 0.1

Synopsis

Effect

class Monad m => MonadPosixCompat (m :: Type -> Type) where Source #

Class for unix-compat effects.

Since: 0.1

Methods

setFileMode :: FilePath -> FileMode -> m () Source #

Since: 0.1

setFdMode :: Fd -> FileMode -> m () Source #

Since: 0.1

setFileCreationMask :: FileMode -> m FileMode Source #

Since: 0.1

fileAccess :: FilePath -> Bool -> Bool -> Bool -> m Bool Source #

Since: 0.1

fileExist :: FilePath -> m Bool Source #

Since: 0.1

getFileStatus :: FilePath -> m FileStatus Source #

Since: 0.1

getFdStatus :: Fd -> m FileStatus Source #

Since: 0.1

getSymbolicLinkStatus :: FilePath -> m FileStatus Source #

Since: 0.1

createNamedPipe :: FilePath -> FileMode -> m () Source #

Since: 0.1

createDevice :: FilePath -> FileMode -> DeviceID -> m () Source #

Since: 0.1

createLink :: FilePath -> FilePath -> m () Source #

Since: 0.1

removeLink :: FilePath -> m () Source #

Since: 0.1

createSymbolicLink :: FilePath -> FilePath -> m () Source #

Since: 0.1

readSymbolicLink :: FilePath -> m FilePath Source #

Since: 0.1

rename :: FilePath -> FilePath -> m () Source #

Since: 0.1

setOwnerAndGroup :: FilePath -> UserID -> GroupID -> m () Source #

Since: 0.1

setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> m () Source #

Since: 0.1

setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> m () Source #

Since: 0.1

setFileTimes :: FilePath -> EpochTime -> EpochTime -> m () Source #

Since: 0.1

touchFile :: FilePath -> m () Source #

Since: 0.1

setFileSize :: FilePath -> FileOffset -> m () Source #

Since: 0.1

setFdSize :: Fd -> FileOffset -> m () Source #

Since: 0.1

getPathVar :: FilePath -> PathVar -> m Limit Source #

Since: 0.1

getFdPathVar :: Fd -> PathVar -> m Limit Source #

Since: 0.1

Instances

Instances details
MonadPosixCompat IO Source #

Since: 0.1

Instance details

Defined in Effects.System.PosixCompat

MonadPosixCompat m => MonadPosixCompat (ReaderT e m) Source #

Since: 0.1

Instance details

Defined in Effects.System.PosixCompat

Methods

setFileMode :: FilePath -> FileMode -> ReaderT e m () Source #

setFdMode :: Fd -> FileMode -> ReaderT e m () Source #

setFileCreationMask :: FileMode -> ReaderT e m FileMode Source #

fileAccess :: FilePath -> Bool -> Bool -> Bool -> ReaderT e m Bool Source #

fileExist :: FilePath -> ReaderT e m Bool Source #

getFileStatus :: FilePath -> ReaderT e m FileStatus Source #

getFdStatus :: Fd -> ReaderT e m FileStatus Source #

getSymbolicLinkStatus :: FilePath -> ReaderT e m FileStatus Source #

createNamedPipe :: FilePath -> FileMode -> ReaderT e m () Source #

createDevice :: FilePath -> FileMode -> DeviceID -> ReaderT e m () Source #

createLink :: FilePath -> FilePath -> ReaderT e m () Source #

removeLink :: FilePath -> ReaderT e m () Source #

createSymbolicLink :: FilePath -> FilePath -> ReaderT e m () Source #

readSymbolicLink :: FilePath -> ReaderT e m FilePath Source #

rename :: FilePath -> FilePath -> ReaderT e m () Source #

setOwnerAndGroup :: FilePath -> UserID -> GroupID -> ReaderT e m () Source #

setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> ReaderT e m () Source #

setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> ReaderT e m () Source #

setFileTimes :: FilePath -> EpochTime -> EpochTime -> ReaderT e m () Source #

touchFile :: FilePath -> ReaderT e m () Source #

setFileSize :: FilePath -> FileOffset -> ReaderT e m () Source #

setFdSize :: Fd -> FileOffset -> ReaderT e m () Source #

getPathVar :: FilePath -> PathVar -> ReaderT e m Limit Source #

getFdPathVar :: Fd -> PathVar -> ReaderT e m Limit Source #

PathType

data PathType Source #

Path type.

Since: fs-utils-0.1

Constructors

PathTypeFile

Since: fs-utils-0.1

PathTypeDirectory

Since: fs-utils-0.1

PathTypeSymbolicLink

Since: fs-utils-0.1

PathTypeOther

Since: fs-utils-0.1

Instances

Instances details
Bounded PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

Enum PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

Generic PathType 
Instance details

Defined in FileSystem.PathType

Associated Types

type Rep PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

type Rep PathType = D1 ('MetaData "PathType" "FileSystem.PathType" "fs-utils-0.1-e372dd9cd77baa6a563dd7032c473a3c70c538a3226981dab13c2716d821a2ce" 'False) ((C1 ('MetaCons "PathTypeFile" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeDirectory" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PathTypeSymbolicLink" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeOther" 'PrefixI 'False) (U1 :: Type -> Type)))

Methods

from :: PathType -> Rep PathType x #

to :: Rep PathType x -> PathType #

Show PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

NFData PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

Methods

rnf :: PathType -> () #

Eq PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

Ord PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

type Rep PathType

Since: fs-utils-0.1

Instance details

Defined in FileSystem.PathType

type Rep PathType = D1 ('MetaData "PathType" "FileSystem.PathType" "fs-utils-0.1-e372dd9cd77baa6a563dd7032c473a3c70c538a3226981dab13c2716d821a2ce" 'False) ((C1 ('MetaCons "PathTypeFile" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeDirectory" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PathTypeSymbolicLink" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PathTypeOther" 'PrefixI 'False) (U1 :: Type -> Type)))

Functions

displayPathType :: IsString a => PathType -> a Source #

String representation of PathType.

Since: fs-utils-0.1

throwIfWrongPathType :: (HasCallStack, MonadCatch m, MonadPosixCompat m) => String -> PathType -> FilePath -> m () Source #

Throws IOException if the path does not exist or the expected path type does not match actual.

Since: 0.1

isPathType :: (HasCallStack, MonadPosixCompat m) => PathType -> FilePath -> m Bool Source #

Checks that the path type matches the expectation. Throws IOException if the path does not exist or the type cannot be detected.

Since: 0.1

getPathType :: (HasCallStack, MonadPosixCompat m) => FilePath -> m PathType Source #

Returns the type for a given path without following symlinks. Throws IOException if the path does not exist or the type cannot be detected.

Since: 0.1