effects-unix-0.1: Unix effects
Safe HaskellNone
LanguageGHC2021

Effects.System.Posix

Description

Provides the MonadPosix typeclass.

Since: 0.1

Synopsis

Effect

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

Class for unix effects.

Since: 0.1

Methods

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

Since: 0.1

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

Since: 0.1

setFileCreationMask :: FileMode -> m FileMode Source #

Since: 0.1

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

Since: 0.1

fileExist :: PosixPath -> m Bool Source #

Since: 0.1

getFileStatus :: PosixPath -> m FileStatus Source #

Since: 0.1

getFdStatus :: Fd -> m FileStatus Source #

Since: 0.1

getSymbolicLinkStatus :: PosixPath -> m FileStatus Source #

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

removeLink :: PosixPath -> m () Source #

Since: 0.1

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

Since: 0.1

readSymbolicLink :: PosixPath -> m PosixPath Source #

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

touchFile :: PosixPath -> m () Source #

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

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

Since: 0.1

Instances

Instances details
MonadPosix IO Source #

Since: 0.1

Instance details

Defined in Effects.System.Posix

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

Since: 0.1

Instance details

Defined in Effects.System.Posix

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

getPathVar :: PosixPath -> 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, MonadPosix m) => String -> PathType -> PosixPath -> m () Source #

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

Since: 0.1

isPathType :: (HasCallStack, MonadPosix m) => PathType -> PosixPath -> 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, MonadPosix m) => PosixPath -> 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