Resume the computation state after an accidental o planned program shutdown (restartWorkflows).

Event handling (waithFor, waitForData).

Monitoring of workflows with state change display and other auxiliary features.

Communications with other processes including other workflows trough persistent data objects,
inspecttion of intermediate workflow results , Queues so that no data is lost due to shutdowns

In this way, a very long computation that may take more time than the average time between
hardware or software failures, shutdowns etc. The workflow can be defined transparently in a single monadic procedure.
Besides state logging and recovery, there are a number of communication primitives that are aware
of persistence across reinitiations such are persistent queues, persistent timeouts, or wait for events
in the STM monad. These primitives permits inter-woikflow communications and communications with
external threads.

This package uses TCache for persistence and event handling.

It also uses the package Refserialize. This package permits to reduce the workflow state load,
since the RefSerialize package permits to serialize and deserialize complex and autoreferenced data structures without
loosing such references, this is critical when big and structured data, such are documents, suffer little
modifications across a set of workflow steps. Therefore, it is also recommended to use Refserialize for
big user-defined objects that have small pieces that suffer little modifications during the workflow. As an
added bonus, the history will show such changes with more detail.

The step primitive is the lift operation that converts a result of type m a to a type Workflow m a
with automatic state loggin and recovery. To allow such features, Every a must be instance of
Typeable and IResource (defined in the TCache package).

In fact, Workflow can be considered as an instance of a partial monad transformed. defined as such:

It is partial because the lift operation is not defined for every monad m and data type a , but for monads and data
types that meet certain conditions. In this case, to be instances of MonadIO, IResource and Typeable respectively.

to avoid to define the last two interfaces however, Read and Show' can be used to derive instances of IResource
for most of the useful cases. This is the set of automatic derivations:

Documentation

Interface that must be defined for every object being cached.
readResource and writeResource are implemented by default as read-write to files with its key as filename
serialize and deserialize are specified just to allow these defaults. If you define your own persistence, then
serialize and deserialize are not needed. The package Workflow need them anyway.

minimal definition: keyResource, serialize, deserialize

While serialize and deserialize are agnostic about the way of converison to strings, either binary or textual, treadp and
tshowp use the monad defined in the RefSerialize package. Both ways of serialization are alternative. one is defined
by default in terms of the other. the RefSerialize monad has been introduced to permit IResource objects to be
serialized as part of larger structures that embody them. This is necessary for the Workdlow package.

The keyResource string must be a unique since this is used to index it in the hash table.
when accessing a resource, the user must provide a partial object for wich the key can be obtained.
for example:

PMonadTrans permits |to define a partial monad transformer. They are not defined for all kinds of data
but the ones that have instances of certain classes.That is because in the lift instance code there are some
hidden use of these classes. This also may permit an accurate control of effects.
An instance of MonadTrans is an instance of PMonadTrans

executes a IO computation inside of the workflow monad whatever the monad encapsulated in the workflow.
Warning: this computation is executed whenever
the workflow restarts, no matter if it has been already executed previously. This is useful for intializations or debugging.
To avoid re-execution when restarting use: step $ unsafeIOtoWF...

To perform IO actions in a workflow that encapsulates an IO monad, use step over the IO action directly:

change the logging policy (default is syncronous)
Workflow uses the package TCache for logging
for very fast workflow steps or when TCache is used also for other purposes , asyncronous is a better option