[Haskell-cafe] announce: Workflow-0.1

Alberto G. Corona agocorona at gmail.com
Tue Nov 11 11:25:49 EST 2008

I needed to to define multiuser web workflows in the most transparent way. I
wondered if a state monad could transparently bring automatic checkpointing
of each action and automatic resume after failure. In this way a long living
computation could be expressed in a single monadic computation.

Additionally,  for inter process communications,  this package  includes a
primitive for  activating a workflow whenever any action result meet certain
condition. There are also primitives for start/restart processes,  retrieval
of intermediate results and unsafe IO actions inside the state monad...


Cabal description:

Transparent low level support (state logging, resume of the computation,
wait for data condition) for long living, event driven processes.

 Workflow give the two first services to any monadic computation of type
(a-> m a) usually m=IO

f x >>=\x'-> g x' >>= \x''->... z

by prefixing the user with the method "step":

step f x >>= \x'-> step g x' >>= \x''->...

This means that a workflow can be described with the familiar "do" notation.
In principle, there is no other limitation on the syntax but the restriction
(a -> m a): All computations consume and produce the same type of data. do
notation is supported fully.

Workflow export a few primitives that bring the following services:

- transparent checkpointing of each step in permanent storage using TCache
- resume of the monadic computation at the last checkpoint after soft or
hard interruption
- use of versioning techniques for storing object changes (using
- retrieval of the object at any previous step
- suspend the computation (waitFor) until the input object meet certain
conditions. useful for inter-workflow comunications.

At the end of the workflow all the intermediate data is erased. see demos
and the header of Control.TCache for documentation.

This is a piece of code is a loop that imput numbers (demo.hs). there is
another process, that check the numbers entered and return Finish when match
the desired number. that is detected by this thread and finalize. When
number of tries are 9, The process finish, this is detected by the other
process and finalizes also.
That ilustrates the use of event handling (waitFor) and step execution.

askNumbers name d = do
      step2 $  threadDelay 5000                                       --
wait for the other tread to process.

      r <- step (waitFor anything) d                                   --
get the last value of the object with key "try-finish", to look for the
other thread actions
      case r of

       Finish msg ->  step2 $ print
msg                                                                   --the
other thread sent a finalize response

       Try 9 num  ->  step1 $ return $ Finish  "sorry, no more
guesses"                         --send finalization to the wait thread

       _ -> do
             nd <- step  (askNumber name) d
             askNumbers name nd
      anything= \_-> True
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081111/778f6adc/attachment.htm

More information about the Haskell-Cafe mailing list