transient-0.4.4: Making composable programs with multithreading, events and distributed computing

Safe Haskell None Haskell2010

Transient.Backtrack

Synopsis

# generalized versions of backtracking with an extra parameter that gives the reason for going back.

onBack :: (Typeable b, Show b) => TransientIO a -> (b -> TransientIO a) -> TransientIO a Source #

the second parameter will be executed when backtracking

back :: (Typeable b, Show b) => b -> TransientIO a Source #

execute backtracking. It execute the registered actions in reverse order.

If the backtracking flag is changed the flow proceed forward from that point on.

If the backtrack stack is finished or undoCut executed, undo will stop.

forward :: (Typeable b, Show b) => b -> TransIO () Source #

restart the flow forward from this point on

backCut :: (Typeable reason, Show reason) => reason -> TransientIO () Source #

assures that backtracking will not go further back

registerBack :: (Typeable b, Show b) => b -> TransientIO a -> TransientIO a Source #

register an action that will be executed when backtracking

# finalization primitives

trigger the event, so this closes all the resources

onFinish :: (Maybe SomeException -> TransIO ()) -> TransIO () Source #

set a computation to be called when the finish event happens

onFinish' :: TransIO a -> (Maybe SomeException -> TransIO a) -> TransIO a Source #

set a computation to be called when the finish event happens this only apply for

initialize the event variable for finalization. all the following computations in different threads will share it it also isolate this event from other branches that may have his own finish variable

kill all the processes generated by the parameter when finish event occurs

trigger finish when the stream of data ends

Instances

 Source # MethodsshowList :: [FinishReason] -> ShowS #