box-0.2.0: boxes

Safe HaskellNone
LanguageHaskell2010

Box.Control

Description

An example of a Box for the command line.

Synopsis

Documentation

data ControlRequest Source #

request ADT

Constructors

Check 
Stop 
Quit 
Start 
Reset 
Kill 
Instances
Eq ControlRequest Source # 
Instance details

Defined in Box.Control

Data ControlRequest Source # 
Instance details

Defined in Box.Control

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControlRequest -> c ControlRequest #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControlRequest #

toConstr :: ControlRequest -> Constr #

dataTypeOf :: ControlRequest -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControlRequest) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControlRequest) #

gmapT :: (forall b. Data b => b -> b) -> ControlRequest -> ControlRequest #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControlRequest -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControlRequest -> r #

gmapQ :: (forall d. Data d => d -> u) -> ControlRequest -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ControlRequest -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControlRequest -> m ControlRequest #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControlRequest -> m ControlRequest #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControlRequest -> m ControlRequest #

Read ControlRequest Source # 
Instance details

Defined in Box.Control

Show ControlRequest Source # 
Instance details

Defined in Box.Control

Generic ControlRequest Source # 
Instance details

Defined in Box.Control

Associated Types

type Rep ControlRequest :: Type -> Type #

type Rep ControlRequest Source # 
Instance details

Defined in Box.Control

type Rep ControlRequest = D1 (MetaData "ControlRequest" "Box.Control" "box-0.2.0-EGKessnexgt3wbLMeHdlLJ" False) ((C1 (MetaCons "Check" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Stop" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Quit" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "Start" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Reset" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Kill" PrefixI False) (U1 :: Type -> Type))))

data ControlResponse Source #

response ADT

Constructors

ShutDown 
On Bool 
Log Text 
Instances
Eq ControlResponse Source # 
Instance details

Defined in Box.Control

Data ControlResponse Source # 
Instance details

Defined in Box.Control

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ControlResponse -> c ControlResponse #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ControlResponse #

toConstr :: ControlResponse -> Constr #

dataTypeOf :: ControlResponse -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ControlResponse) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ControlResponse) #

gmapT :: (forall b. Data b => b -> b) -> ControlResponse -> ControlResponse #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ControlResponse -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ControlResponse -> r #

gmapQ :: (forall d. Data d => d -> u) -> ControlResponse -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ControlResponse -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ControlResponse -> m ControlResponse #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ControlResponse -> m ControlResponse #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ControlResponse -> m ControlResponse #

Read ControlResponse Source # 
Instance details

Defined in Box.Control

Show ControlResponse Source # 
Instance details

Defined in Box.Control

Generic ControlResponse Source # 
Instance details

Defined in Box.Control

Associated Types

type Rep ControlResponse :: Type -> Type #

type Rep ControlResponse Source # 
Instance details

Defined in Box.Control

data ControlConfig Source #

Should the box be kept alive?

Constructors

KeepAlive Double 
AllowDeath 
Instances
Eq ControlConfig Source # 
Instance details

Defined in Box.Control

Show ControlConfig Source # 
Instance details

Defined in Box.Control

defaultControlConfig :: ControlConfig Source #

Defauilt is to let the box die.

consoleControlBox :: ControlBox IO Source #

a command-line control box.

parseControlRequest :: Parser ControlRequest Source #

Parse command line requests

controlBox :: IO a -> Box (STM IO) ControlResponse ControlRequest -> IO () Source #

an effect that can be started and stopped

testBox :: IO () Source #

send Start, wait for a Ready signal, run action, wait x secs, then send Quit

timeOut :: Double -> ControlBox m Source #

A box with a self-destruct timer.