haskus-system-0.7.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.System.Sys

Contents

Description

Sys monad

Synopsis

Documentation

data Sys a Source #

Sys monad

The monad that permits fun system programming: * includes an optional logger

Instances

Monad Sys Source # 

Methods

(>>=) :: Sys a -> (a -> Sys b) -> Sys b #

(>>) :: Sys a -> Sys b -> Sys b #

return :: a -> Sys a #

fail :: String -> Sys a #

Functor Sys Source # 

Methods

fmap :: (a -> b) -> Sys a -> Sys b #

(<$) :: a -> Sys b -> Sys a #

Applicative Sys Source # 

Methods

pure :: a -> Sys a #

(<*>) :: Sys (a -> b) -> Sys a -> Sys b #

(*>) :: Sys a -> Sys b -> Sys b #

(<*) :: Sys a -> Sys b -> Sys a #

MonadIO Sys Source # 

Methods

liftIO :: IO a -> Sys a #

MonadInIO Sys Source # 

Methods

liftWith :: (forall c. (a -> IO c) -> IO c) -> (a -> Sys b) -> Sys b #

liftWith2 :: (forall c. (a -> b -> IO c) -> IO c) -> (a -> b -> Sys e) -> Sys e #

runSys :: Sys a -> IO a Source #

Run

runSys' :: Sys a -> IO () Source #

Run and return nothing

forkSys :: String -> Sys a -> Sys (IO a) Source #

Fork the log in the Sys monad

sysRun :: SysState -> Sys a -> IO (a, SysState) Source #

Run with an explicit state

sysRun' :: SysState -> Sys a -> IO ((), SysState) Source #

Run with an explicit state

sysExec :: SysState -> Sys a -> IO SysState Source #

Exec with an explicit state

data Log Source #

Hierarchical thread-safe log

Constructors

LogEntry Text LogType LogNext 
LogGroup Text (Future Log) LogNext 
LogFork Text LogNext LogNext 

data LogType Source #

Log type

sysLog :: LogType -> String -> Sys () Source #

Add a new entry to the log

sysLogPrint :: Sys () Source #

Print the log on the standard output FIXME: use System.Terminal

sysLogSequence :: String -> Sys a -> Sys a Source #

Add a new sequence of actions to the log

setLogStatus :: LogStatus -> Sys () Source #

Set log status

sysAssert :: String -> Bool -> Sys () Source #

Assert in Sys (log the success)

sysAssertQuiet :: String -> Bool -> Sys () Source #

Assert in Sys (don't log on success)

sysError :: String -> Sys a Source #

Fail in Sys

sysWarning :: String -> Sys () Source #

Log Warning in Sys

sysLogInfo :: String -> Sys () Source #

Log Info in Sys

sysErrorShow :: Show a => String -> a -> Sys b Source #

Fail in Sys

sysWarningShow :: Show a => String -> a -> Sys () Source #

Warning in Sys

sysLogInfoShow :: Show a => String -> a -> Sys () Source #

Log Info in Sys

Flow helpers

flowAssertQuiet :: Show (Variant xs) => String -> Flow Sys (a ': xs) -> Sys a Source #

Assert a successful result, and log the error otherwise

flowAssert :: (Show a, Show (Variant xs)) => String -> Flow Sys (a ': xs) -> Sys a Source #

Assert a successful result, log on error and on success

assertShow :: Show a => String -> a -> Sys () Source #

warningShow :: Show (Variant xs) => String -> Flow Sys (a ': xs) -> Sys () Source #