A workflow can be seen as a persistent thread.
The workflow monad writes a log that permit to restore the thread
at the interrupted point. step is the (partial) monad transformer for
the Workflow monad. A workflow is defined by its name and, optionally
by the key of the single parameter passed. The primitives for starting workflows
also restart the workflow when it has been in execution previously.

This is the main module that uses the RefSerialize paclkage for serialization. Here the constraint DynSerializer w r a is equivalent to
Data.RefSerialize a

For workflows that uses big structures, for example, documents
use this module in combination with the RefSerialize package to define the (de)serialization instances
The log size will be reduced. printWFHistory` method will print the structure changes
in each step.

If instead of RefSerialize, you define read and show instances, there will
be no reduction. but still the log will be readable for debugging purposes.

Documentation

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 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:

Writes a new value en in the workflow reference, that is, in the workflow log.
Why would you use this?. Don do that!. modifiying the content of the workflow log would
change the excution flow when the workflow restarts. This metod is used internally in the package
the best way to communicate with a workflow is trough a persistent queue:

Start the timeout and return the flag to be monitored by waitUntilSTM
This timeout is persistent. This means that the time start to count from the first call to getTimeoutFlag on
no matter if the workflow is restarted. The time that the worlkflow has been stopped count also.
the wait time can exceed the time between failures.
when timeout is 0 means no timeout.