propellor-5.10.1: property-based host configuration management in haskell

Safe HaskellNone
LanguageHaskell98

Propellor.Utilities

Description

Re-exports some of propellor's internal utility modules.

These are used in the implementation of propellor, including some of its properties. However, there is no API stability; any of these can change or be removed without a major version number increase.

Use outside propellor at your own risk.

Synopsis

Documentation

read :: Read a => String -> a Source #

head :: [a] -> a Source #

tail :: [a] -> [a] Source #

init :: [a] -> [a] Source #

last :: [a] -> a Source #

readish :: Read a => String -> Maybe a Source #

headMaybe :: [a] -> Maybe a Source #

lastMaybe :: [a] -> Maybe a Source #

beginning :: [a] -> [a] Source #

end :: [a] -> [a] Source #

callCommand :: String -> IO () #

callProcess :: FilePath -> [String] -> IO () #

cleanupProcess :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO () #

getPid :: ProcessHandle -> IO (Maybe Pid) #

getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode) #

proc :: FilePath -> [String] -> CreateProcess #

readCreateProcess :: CreateProcess -> String -> IO String #

readCreateProcessWithExitCode :: CreateProcess -> String -> IO (ExitCode, String, String) #

runCommand :: String -> IO ProcessHandle #

shell :: String -> CreateProcess #

showCommandForUser :: FilePath -> [String] -> String #

spawnCommand :: String -> IO ProcessHandle #

spawnProcess :: FilePath -> [String] -> IO ProcessHandle #

withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a #

createPipe :: IO (Handle, Handle) #

createPipeFd :: IO (FD, FD) #

createProcess_ :: String -> CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) #

type Pid = CPid #

data CmdSpec #

Constructors

ShellCommand String 
RawCommand FilePath [String] 
Instances
Eq CmdSpec 
Instance details

Defined in System.Process.Common

Methods

(==) :: CmdSpec -> CmdSpec -> Bool

(/=) :: CmdSpec -> CmdSpec -> Bool

Show CmdSpec 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> CmdSpec -> ShowS

show :: CmdSpec -> String

showList :: [CmdSpec] -> ShowS

IsString CmdSpec 
Instance details

Defined in System.Process.Common

Methods

fromString :: String -> CmdSpec #

data StdStream #

Constructors

Inherit 
UseHandle Handle 
CreatePipe 
NoStream 
Instances
Eq StdStream 
Instance details

Defined in System.Process.Common

Methods

(==) :: StdStream -> StdStream -> Bool

(/=) :: StdStream -> StdStream -> Bool

Show StdStream 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> StdStream -> ShowS

show :: StdStream -> String

showList :: [StdStream] -> ShowS

data CreateProcess #

Constructors

CreateProcess 

Fields

Instances
Eq CreateProcess 
Instance details

Defined in System.Process.Common

Show CreateProcess 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> CreateProcess -> ShowS

show :: CreateProcess -> String

showList :: [CreateProcess] -> ShowS

data StdHandle Source #

Instances
Eq StdHandle Source # 
Instance details

Defined in Utility.Process

Methods

(==) :: StdHandle -> StdHandle -> Bool

(/=) :: StdHandle -> StdHandle -> Bool

readProcess :: FilePath -> [String] -> IO String Source #

Normally, when reading from a process, it does not need to be fed any standard input.

readProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> IO String Source #

writeReadProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> Maybe (Handle -> IO ()) -> Maybe (Handle -> IO ()) -> IO String Source #

Runs an action to write to a process on its stdin, returns its output, and also allows specifying the environment.

forceSuccessProcess :: CreateProcess -> ProcessHandle -> IO () Source #

Waits for a ProcessHandle, and throws an IOError if the process did not exit successfully.

forceSuccessProcess' :: CreateProcess -> ExitCode -> IO () Source #

checkSuccessProcess :: ProcessHandle -> IO Bool Source #

Waits for a ProcessHandle and returns True if it exited successfully. Note that using this with createProcessChecked will throw away the Bool, and is only useful to ignore the exit code of a process, while still waiting for it. -}

createProcessSuccess :: CreateProcessRunner Source #

Runs createProcess, then an action on its handles, and then forceSuccessProcess.

createProcessChecked :: (ProcessHandle -> IO b) -> CreateProcessRunner Source #

Runs createProcess, then an action on its handles, and then a checker action on its exit code, which must wait for the process.

createBackgroundProcess :: CreateProcessRunner Source #

Leaves the process running, suitable for lazy streaming. Note: Zombies will result, and must be waited on.

withHandle :: StdHandle -> CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a Source #

Runs a CreateProcessRunner, on a CreateProcess structure, that is adjusted to pipe only from/to a single StdHandle, and passes the resulting Handle to an action.

withIOHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a Source #

Like withHandle, but passes (stdin, stdout) handles to the action.

withOEHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a Source #

Like withHandle, but passes (stdout, stderr) handles to the action.

withNullHandle :: (Handle -> IO a) -> IO a Source #

withQuietOutput :: CreateProcessRunner -> CreateProcess -> IO () Source #

Forces the CreateProcessRunner to run quietly; both stdout and stderr are discarded.

feedWithQuietOutput :: CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a Source #

Stdout and stderr are discarded, while the process is fed stdin from the handle.

createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source #

Wrapper around createProcess that does debug logging.

waitForProcess :: ProcessHandle -> IO ExitCode Source #

Wrapper around waitForProcess that does debug logging.

startInteractiveProcess :: FilePath -> [String] -> Maybe [(String, String)] -> IO (ProcessHandle, Handle, Handle) Source #

Starts an interactive process. Unlike runInteractiveProcess in System.Process, stderr is inherited.

stdinHandle :: HandleExtractor Source #

stdoutHandle :: HandleExtractor Source #

stderrHandle :: HandleExtractor Source #

ioHandles :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> (Handle, Handle) Source #

processHandle :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> ProcessHandle Source #

devNull :: FilePath Source #

processTranscript :: String -> [String] -> Maybe String -> IO (String, Bool) Source #

Runs a process and returns a transcript combining its stdout and stderr, and whether it succeeded or failed.

processTranscript' :: CreateProcess -> Maybe String -> IO (String, Bool) Source #

Also feeds the process some input.

processTranscript'' :: CreateProcess -> Maybe String -> IO (String, ExitCode) Source #

class (Typeable e, Show e) => Exception e where #

Minimal complete definition

Nothing

Methods

toException :: e -> SomeException #

fromException :: SomeException -> Maybe e #

displayException :: e -> String #

Instances
Exception NestedAtomically 
Instance details

Defined in Control.Exception.Base

Methods

toException :: NestedAtomically -> SomeException #

fromException :: SomeException -> Maybe NestedAtomically #

displayException :: NestedAtomically -> String #

Exception NoMethodError 
Instance details

Defined in Control.Exception.Base

Methods

toException :: NoMethodError -> SomeException #

fromException :: SomeException -> Maybe NoMethodError #

displayException :: NoMethodError -> String #

Exception NonTermination 
Instance details

Defined in Control.Exception.Base

Methods

toException :: NonTermination -> SomeException #

fromException :: SomeException -> Maybe NonTermination #

displayException :: NonTermination -> String #

Exception PatternMatchFail 
Instance details

Defined in Control.Exception.Base

Methods

toException :: PatternMatchFail -> SomeException #

fromException :: SomeException -> Maybe PatternMatchFail #

displayException :: PatternMatchFail -> String #

Exception RecConError 
Instance details

Defined in Control.Exception.Base

Methods

toException :: RecConError -> SomeException #

fromException :: SomeException -> Maybe RecConError #

displayException :: RecConError -> String #

Exception RecSelError 
Instance details

Defined in Control.Exception.Base

Methods

toException :: RecSelError -> SomeException #

fromException :: SomeException -> Maybe RecSelError #

displayException :: RecSelError -> String #

Exception RecUpdError 
Instance details

Defined in Control.Exception.Base

Methods

toException :: RecUpdError -> SomeException #

fromException :: SomeException -> Maybe RecUpdError #

displayException :: RecUpdError -> String #

Exception TypeError 
Instance details

Defined in Control.Exception.Base

Methods

toException :: TypeError -> SomeException #

fromException :: SomeException -> Maybe TypeError #

displayException :: TypeError -> String #

Exception ErrorCall 
Instance details

Defined in GHC.Exception

Methods

toException :: ErrorCall -> SomeException #

fromException :: SomeException -> Maybe ErrorCall #

displayException :: ErrorCall -> String #

Exception ArithException 
Instance details

Defined in GHC.Exception.Type

Methods

toException :: ArithException -> SomeException #

fromException :: SomeException -> Maybe ArithException #

displayException :: ArithException -> String #

Exception SomeException 
Instance details

Defined in GHC.Exception.Type

Exception AllocationLimitExceeded 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: AllocationLimitExceeded -> SomeException #

fromException :: SomeException -> Maybe AllocationLimitExceeded #

displayException :: AllocationLimitExceeded -> String #

Exception ArrayException 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: ArrayException -> SomeException #

fromException :: SomeException -> Maybe ArrayException #

displayException :: ArrayException -> String #

Exception AssertionFailed 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: AssertionFailed -> SomeException #

fromException :: SomeException -> Maybe AssertionFailed #

displayException :: AssertionFailed -> String #

Exception AsyncException 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: AsyncException -> SomeException #

fromException :: SomeException -> Maybe AsyncException #

displayException :: AsyncException -> String #

Exception BlockedIndefinitelyOnMVar 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: BlockedIndefinitelyOnMVar -> SomeException #

fromException :: SomeException -> Maybe BlockedIndefinitelyOnMVar #

displayException :: BlockedIndefinitelyOnMVar -> String #

Exception BlockedIndefinitelyOnSTM 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: BlockedIndefinitelyOnSTM -> SomeException #

fromException :: SomeException -> Maybe BlockedIndefinitelyOnSTM #

displayException :: BlockedIndefinitelyOnSTM -> String #

Exception CompactionFailed 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: CompactionFailed -> SomeException #

fromException :: SomeException -> Maybe CompactionFailed #

displayException :: CompactionFailed -> String #

Exception Deadlock 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: Deadlock -> SomeException #

fromException :: SomeException -> Maybe Deadlock #

displayException :: Deadlock -> String #

Exception IOException 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: IOException -> SomeException #

fromException :: SomeException -> Maybe IOException #

displayException :: IOException -> String #

Exception SomeAsyncException 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: SomeAsyncException -> SomeException #

fromException :: SomeException -> Maybe SomeAsyncException #

displayException :: SomeAsyncException -> String #

Exception ExitCode 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: ExitCode -> SomeException #

fromException :: SomeException -> Maybe ExitCode #

displayException :: ExitCode -> String #

Exception FixIOException 
Instance details

Defined in GHC.IO.Exception

Methods

toException :: FixIOException -> SomeException #

fromException :: SomeException -> Maybe FixIOException #

displayException :: FixIOException -> String #

Exception StopPropellorException Source # 
Instance details

Defined in Propellor.Types.Exception

Exception Dynamic 
Instance details

Defined in Data.Dynamic

Methods

toException :: Dynamic -> SomeException #

fromException :: SomeException -> Maybe Dynamic #

displayException :: Dynamic -> String #

Exception Void 
Instance details

Defined in Data.Void

Methods

toException :: Void -> SomeException #

fromException :: SomeException -> Maybe Void #

displayException :: Void -> String #

Exception AsyncCancelled 
Instance details

Defined in Control.Concurrent.Async

Methods

toException :: AsyncCancelled -> SomeException #

fromException :: SomeException -> Maybe AsyncCancelled #

displayException :: AsyncCancelled -> String #

Exception ExceptionInLinkedThread 
Instance details

Defined in Control.Concurrent.Async

Methods

toException :: ExceptionInLinkedThread -> SomeException #

fromException :: SomeException -> Maybe ExceptionInLinkedThread #

displayException :: ExceptionInLinkedThread -> String #

data SomeException where #

Constructors

SomeException :: forall e. Exception e => e -> SomeException 
Instances
Show SomeException 
Instance details

Defined in GHC.Exception.Type

Methods

showsPrec :: Int -> SomeException -> ShowS

show :: SomeException -> String

showList :: [SomeException] -> ShowS

Exception SomeException 
Instance details

Defined in GHC.Exception.Type

bracket :: MonadMask m => m a -> (a -> m c) -> (a -> m b) -> m b #

bracketOnError :: MonadMask m => m a -> (a -> m c) -> (a -> m b) -> m b #

bracket_ :: MonadMask m => m a -> m c -> m b -> m b #

catchAll :: MonadCatch m => m a -> (SomeException -> m a) -> m a #

catchIOError :: MonadCatch m => m a -> (IOError -> m a) -> m a #

catchIf :: (MonadCatch m, Exception e) => (e -> Bool) -> m a -> (e -> m a) -> m a #

catchJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a #

catches :: (Foldable f, MonadCatch m) => m a -> f (Handler m a) -> m a #

finally :: MonadMask m => m a -> m b -> m a #

handle :: (MonadCatch m, Exception e) => (e -> m a) -> m a -> m a #

handleAll :: MonadCatch m => (SomeException -> m a) -> m a -> m a #

handleIOError :: MonadCatch m => (IOError -> m a) -> m a -> m a #

handleIf :: (MonadCatch m, Exception e) => (e -> Bool) -> (e -> m a) -> m a -> m a #

handleJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a #

mask_ :: MonadMask m => m a -> m a #

onError :: MonadMask m => m a -> m b -> m a #

onException :: MonadCatch m => m a -> m b -> m a #

try :: (MonadCatch m, Exception e) => m a -> m (Either e a) #

tryJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a) #

uninterruptibleMask_ :: MonadMask m => m a -> m a #

data ExitCase a #

Instances
Show a => Show (ExitCase a) 
Instance details

Defined in Control.Monad.Catch

Methods

showsPrec :: Int -> ExitCase a -> ShowS

show :: ExitCase a -> String

showList :: [ExitCase a] -> ShowS

class MonadThrow m => MonadCatch (m :: Type -> Type) where #

Methods

catch :: Exception e => m a -> (e -> m a) -> m a #

Instances
MonadCatch IO 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => IO a -> (e -> IO a) -> IO a #

MonadCatch STM 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => STM a -> (e -> STM a) -> STM a #

MonadCatch Propellor Source # 
Instance details

Defined in Propellor.Types.Core

Methods

catch :: Exception e => Propellor a -> (e -> Propellor a) -> Propellor a #

e ~ SomeException => MonadCatch (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => Either e a -> (e0 -> Either e a) -> Either e a #

MonadCatch m => MonadCatch (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => ListT m a -> (e -> ListT m a) -> ListT m a #

MonadCatch m => MonadCatch (MaybeT m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a #

(Error e, MonadCatch m) => MonadCatch (ErrorT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => ErrorT e m a -> (e0 -> ErrorT e m a) -> ErrorT e m a #

MonadCatch m => MonadCatch (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => ExceptT e m a -> (e0 -> ExceptT e m a) -> ExceptT e m a #

MonadCatch m => MonadCatch (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => IdentityT m a -> (e -> IdentityT m a) -> IdentityT m a #

MonadCatch m => MonadCatch (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a #

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a #

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a #

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

class MonadCatch m => MonadMask (m :: Type -> Type) where #

Methods

mask :: ((forall a. m a -> m a) -> m b) -> m b #

uninterruptibleMask :: ((forall a. m a -> m a) -> m b) -> m b #

generalBracket :: m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c) #

Instances
MonadMask IO 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

generalBracket :: IO a -> (a -> ExitCase b -> IO c) -> (a -> IO b) -> IO (b, c) #

MonadMask Propellor Source # 
Instance details

Defined in Propellor.Types.Core

Methods

mask :: ((forall a. Propellor a -> Propellor a) -> Propellor b) -> Propellor b #

uninterruptibleMask :: ((forall a. Propellor a -> Propellor a) -> Propellor b) -> Propellor b #

generalBracket :: Propellor a -> (a -> ExitCase b -> Propellor c) -> (a -> Propellor b) -> Propellor (b, c) #

e ~ SomeException => MonadMask (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. Either e a -> Either e a) -> Either e b) -> Either e b #

uninterruptibleMask :: ((forall a. Either e a -> Either e a) -> Either e b) -> Either e b #

generalBracket :: Either e a -> (a -> ExitCase b -> Either e c) -> (a -> Either e b) -> Either e (b, c) #

MonadMask m => MonadMask (MaybeT m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b #

uninterruptibleMask :: ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b #

generalBracket :: MaybeT m a -> (a -> ExitCase b -> MaybeT m c) -> (a -> MaybeT m b) -> MaybeT m (b, c) #

(Error e, MonadMask m) => MonadMask (ErrorT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. ErrorT e m a -> ErrorT e m a) -> ErrorT e m b) -> ErrorT e m b #

uninterruptibleMask :: ((forall a. ErrorT e m a -> ErrorT e m a) -> ErrorT e m b) -> ErrorT e m b #

generalBracket :: ErrorT e m a -> (a -> ExitCase b -> ErrorT e m c) -> (a -> ErrorT e m b) -> ErrorT e m (b, c) #

MonadMask m => MonadMask (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b #

uninterruptibleMask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b #

generalBracket :: ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c) #

MonadMask m => MonadMask (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b #

uninterruptibleMask :: ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b #

generalBracket :: IdentityT m a -> (a -> ExitCase b -> IdentityT m c) -> (a -> IdentityT m b) -> IdentityT m (b, c) #

MonadMask m => MonadMask (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b #

uninterruptibleMask :: ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b #

generalBracket :: ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) #

MonadMask m => MonadMask (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b #

uninterruptibleMask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b #

generalBracket :: StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) #

MonadMask m => MonadMask (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b #

uninterruptibleMask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b #

generalBracket :: StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) #

(MonadMask m, Monoid w) => MonadMask (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b #

uninterruptibleMask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b #

generalBracket :: WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) #

(MonadMask m, Monoid w) => MonadMask (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b #

uninterruptibleMask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b #

generalBracket :: WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) #

(MonadMask m, Monoid w) => MonadMask (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b #

uninterruptibleMask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b #

generalBracket :: RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) #

(MonadMask m, Monoid w) => MonadMask (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b #

uninterruptibleMask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b #

generalBracket :: RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) #

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

Methods

throwM :: Exception e => e -> m a #

Instances
MonadThrow [] 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> [a] #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

MonadThrow IO 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IO a #

MonadThrow Q 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Q a #

MonadThrow STM 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> STM a #

MonadThrow Propellor Source # 
Instance details

Defined in Propellor.Types.Core

Methods

throwM :: Exception e => e -> Propellor a #

e ~ SomeException => MonadThrow (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> Either e a #

MonadThrow m => MonadThrow (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ListT m a #

MonadThrow m => MonadThrow (MaybeT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> MaybeT m a #

(Error e, MonadThrow m) => MonadThrow (ErrorT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ErrorT e m a #

MonadThrow m => MonadThrow (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a #

MonadThrow m => MonadThrow (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IdentityT m a #

MonadThrow m => MonadThrow (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ReaderT r m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

giveup :: [Char] -> a Source #

catchBoolIO :: MonadCatch m => m Bool -> m Bool Source #

catchMaybeIO :: MonadCatch m => m a -> m (Maybe a) Source #

catchDefaultIO :: MonadCatch m => a -> m a -> m a Source #

catchMsgIO :: MonadCatch m => m a -> m (Either String a) Source #

catchIO :: MonadCatch m => m a -> (IOException -> m a) -> m a Source #

tryIO :: MonadCatch m => m a -> m (Either IOException a) Source #

bracketIO :: (MonadMask m, MonadIO m) => IO v -> (v -> IO b) -> (v -> m a) -> m a Source #

catchNonAsync :: MonadCatch m => m a -> (SomeException -> m a) -> m a Source #

tryNonAsync :: MonadCatch m => m a -> m (Either SomeException a) Source #

tryWhenExists :: MonadCatch m => m a -> m (Maybe a) Source #

catchIOErrorType :: MonadCatch m => IOErrorType -> (IOException -> m a) -> m a -> m a Source #

catchPermissionDenied :: MonadCatch m => (IOException -> m a) -> m a -> m a Source #

getEnv :: String -> IO (Maybe String) Source #

getEnvDefault :: String -> String -> IO String Source #

getEnvironment :: IO [(String, String)] Source #

addEntry :: Eq k => k -> v -> [(k, v)] -> [(k, v)] Source #

addEntries :: Eq k => [(k, v)] -> [(k, v)] -> [(k, v)] Source #

delEntry :: Eq k => k -> [(k, v)] -> [(k, v)] Source #

setEnv :: String -> String -> Bool -> IO () Source #

unsetEnv :: String -> IO () Source #

dirCruft :: FilePath -> Bool Source #

dirContents :: FilePath -> IO [FilePath] Source #

dirContentsRecursive :: FilePath -> IO [FilePath] Source #

dirContentsRecursiveSkipping :: (FilePath -> Bool) -> Bool -> FilePath -> IO [FilePath] Source #

dirTreeRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath] Source #

moveFile :: FilePath -> FilePath -> IO () Source #

nukeFile :: FilePath -> IO () Source #

canonicalizePath :: FilePath -> IO FilePath #

copyFile :: FilePath -> FilePath -> IO () #

copyFileWithMetadata :: FilePath -> FilePath -> IO () #

copyPermissions :: FilePath -> FilePath -> IO () #

createDirectory :: FilePath -> IO () #

createDirectoryIfMissing :: Bool -> FilePath -> IO () #

createDirectoryLink :: FilePath -> FilePath -> IO () #

createFileLink :: FilePath -> FilePath -> IO () #

doesDirectoryExist :: FilePath -> IO Bool #

doesFileExist :: FilePath -> IO Bool #

doesPathExist :: FilePath -> IO Bool #

exeExtension :: String #

findExecutable :: String -> IO (Maybe FilePath) #

findExecutables :: String -> IO [FilePath] #

findExecutablesInDirectories :: [FilePath] -> String -> IO [FilePath] #

findFile :: [FilePath] -> String -> IO (Maybe FilePath) #

findFileWith :: (FilePath -> IO Bool) -> [FilePath] -> String -> IO (Maybe FilePath) #

findFiles :: [FilePath] -> String -> IO [FilePath] #

findFilesWith :: (FilePath -> IO Bool) -> [FilePath] -> String -> IO [FilePath] #

getAccessTime :: FilePath -> IO UTCTime #

getAppUserDataDirectory :: FilePath -> IO FilePath #

getCurrentDirectory :: IO FilePath #

getDirectoryContents :: FilePath -> IO [FilePath] #

getHomeDirectory :: IO FilePath #

getModificationTime :: FilePath -> IO UTCTime #

getPermissions :: FilePath -> IO Permissions #

getSymbolicLinkTarget :: FilePath -> IO FilePath #

getTemporaryDirectory :: IO FilePath #

getXdgDirectory :: XdgDirectory -> FilePath -> IO FilePath #

listDirectory :: FilePath -> IO [FilePath] #

makeAbsolute :: FilePath -> IO FilePath #

makeRelativeToCurrentDirectory :: FilePath -> IO FilePath #

pathIsSymbolicLink :: FilePath -> IO Bool #

removeDirectory :: FilePath -> IO () #

removeDirectoryLink :: FilePath -> IO () #

removeDirectoryRecursive :: FilePath -> IO () #

removeFile :: FilePath -> IO () #

removePathForcibly :: FilePath -> IO () #

renameDirectory :: FilePath -> FilePath -> IO () #

renameFile :: FilePath -> FilePath -> IO () #

renamePath :: FilePath -> FilePath -> IO () #

setAccessTime :: FilePath -> UTCTime -> IO () #

setCurrentDirectory :: FilePath -> IO () #

setModificationTime :: FilePath -> UTCTime -> IO () #

setPermissions :: FilePath -> Permissions -> IO () #

withCurrentDirectory :: FilePath -> IO a -> IO a #

data Permissions #

Instances
Eq Permissions 
Instance details

Defined in System.Directory.Internal.Common

Methods

(==) :: Permissions -> Permissions -> Bool

(/=) :: Permissions -> Permissions -> Bool

Ord Permissions 
Instance details

Defined in System.Directory.Internal.Common

Read Permissions 
Instance details

Defined in System.Directory.Internal.Common

Methods

readsPrec :: Int -> ReadS Permissions

readList :: ReadS [Permissions]

readPrec :: ReadPrec Permissions

readListPrec :: ReadPrec [Permissions]

Show Permissions 
Instance details

Defined in System.Directory.Internal.Common

Methods

showsPrec :: Int -> Permissions -> ShowS

show :: Permissions -> String

showList :: [Permissions] -> ShowS

data XdgDirectory #

Constructors

XdgData 
XdgConfig 
XdgCache 
Instances
Bounded XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Enum XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Eq XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Methods

(==) :: XdgDirectory -> XdgDirectory -> Bool

(/=) :: XdgDirectory -> XdgDirectory -> Bool

Ord XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Read XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Methods

readsPrec :: Int -> ReadS XdgDirectory

readList :: ReadS [XdgDirectory]

readPrec :: ReadPrec XdgDirectory

readListPrec :: ReadPrec [XdgDirectory]

Show XdgDirectory 
Instance details

Defined in System.Directory.Internal.Common

Methods

showsPrec :: Int -> XdgDirectory -> ShowS

show :: XdgDirectory -> String

showList :: [XdgDirectory] -> ShowS

data XdgDirectoryList #

Constructors

XdgDataDirs 
XdgConfigDirs 
Instances
Bounded XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Enum XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Eq XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Ord XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Read XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Show XdgDirectoryList 
Instance details

Defined in System.Directory.Internal.Common

Methods

showsPrec :: Int -> XdgDirectoryList -> ShowS

show :: XdgDirectoryList -> String

showList :: [XdgDirectoryList] -> ShowS

isDirectoryEmpty :: FilePath -> IO Bool Source #

True only when directory exists and contains nothing. Throws exception if directory does not exist.

isUnpopulated :: FilePath -> IO Bool Source #

True if the directory does not exist or contains nothing. Ignores "lost+found" which can exist in an empty filesystem.

fsCruft :: FilePath -> Bool Source #

testDirectory :: FilePath -> (FilePath -> Bool) -> IO Bool Source #

Run test on entries found in directory, return False as soon as the test returns False, else return True. Throws exception if directory does not exist.

type Template = String Source #

viaTmp :: (MonadMask m, MonadIO m) => (FilePath -> v -> m ()) -> FilePath -> v -> m () Source #

withTmpFile :: (MonadIO m, MonadMask m) => Template -> (FilePath -> Handle -> m a) -> m a Source #

withTmpFileIn :: (MonadIO m, MonadMask m) => FilePath -> Template -> (FilePath -> Handle -> m a) -> m a Source #

relatedTemplate :: FilePath -> FilePath Source #

withTmpDir :: (MonadMask m, MonadIO m) => Template -> (FilePath -> m a) -> m a Source #

withTmpDirIn :: (MonadMask m, MonadIO m) => FilePath -> Template -> (FilePath -> m a) -> m a Source #

removeTmpDir :: MonadIO m => FilePath -> m () Source #

firstM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) Source #

getM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b) Source #

anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool Source #

allM :: Monad m => (a -> m Bool) -> [a] -> m Bool Source #

untilTrue :: Monad m => [a] -> (a -> m Bool) -> m Bool Source #

ifM :: Monad m => m Bool -> (m a, m a) -> m a Source #

(<||>) :: Monad m => m Bool -> m Bool -> m Bool infixr 2 Source #

(<&&>) :: Monad m => m Bool -> m Bool -> m Bool infixr 3 Source #

observe :: Monad m => (a -> m b) -> m a -> m a Source #

after :: Monad m => m b -> m a -> m a Source #

noop :: Monad m => m () Source #

hGetContentsStrict :: Handle -> IO String Source #

readFileStrict :: FilePath -> IO String Source #

separate :: (a -> Bool) -> [a] -> ([a], [a]) Source #

firstLine :: String -> String Source #

segment :: (a -> Bool) -> [a] -> [[a]] Source #

segmentDelim :: (a -> Bool) -> [a] -> [[a]] Source #

massReplace :: [(String, String)] -> String -> String Source #

hGetSomeString :: Handle -> Int -> IO String Source #

exitBool :: Bool -> IO a Source #

modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO () Source #

modifyFileMode' :: FilePath -> (FileMode -> FileMode) -> IO FileMode Source #

withModifiedFileMode :: FilePath -> (FileMode -> FileMode) -> IO a -> IO a Source #

preventWrite :: FilePath -> IO () Source #

allowWrite :: FilePath -> IO () Source #

allowRead :: FilePath -> IO () Source #

groupWriteRead :: FilePath -> IO () Source #

noUmask :: (MonadIO m, MonadMask m) => FileMode -> m a -> m a Source #

withUmask :: (MonadIO m, MonadMask m) => FileMode -> m a -> m a Source #

setSticky :: FilePath -> IO () Source #

writeFileProtected :: FilePath -> String -> IO () Source #

writeFileProtected' :: FilePath -> (Handle -> IO ()) -> IO () Source #

protectedOutput :: IO a -> IO a Source #

type FileMode = CMode #