 | WashNGo-2.9: WASH is a family of embedded domain specific languages (EDSL) for programming Web applications in Haskell. | Contents | Index |
|
|
|
Description |
Transactional, type-indexed implementation of server-side state.
Glossary
A transactional entity (TE) is a named multi-versioned global variable.
|
|
Synopsis |
|
|
|
Documentation |
|
data T a |
Handle of a transactional variable
| Instances | |
|
|
init :: (Types a, Read a, Show a) => String -> a -> TCGI b (T a) |
Attempt to create a new tv n and set its initial value. Returns handle to
the variable. If the variable already exists, then just returns the handle.
|
|
create :: (Read a, Show a, Types a) => a -> TCGI b (T a) |
Create a fresh transactional variable with an initial value and return its
handle. Performs a physical write to ensure that the variable's name is
unique. Locks the transaction directory during the write operation.
|
|
remove :: Types a => T a -> TCGI b () |
Remove a transactional variable. Subsequent read accesses to this variable
will make the transaction fail. May throw an exception if the variable is not
present.
|
|
get :: (Read a, Show a) => T a -> TCGI b a |
Read transactional variable through a typed handle.
|
|
set :: (Read a, Show a) => T a -> a -> TCGI b () |
Write to a transactional variable through typed handle. Only affects the
log, no physical write happens. Checks physically for existence of the
variable (but tries the log first). Raises exception if it does not exist.
|
|
with :: (CGIMonad cgi, Read result, Show result) => result -> (result -> cgi ()) -> (Control (TCGI result) result -> TCGI result ()) -> cgi () |
with creates a transactional scope in which transactional variables can
be manipulated. Transactions may be nested to an arbitrary depth, although a
check with the current state of the world only occurs at the point where the
top-level transaction tries to commit.
with takes three parameters, a default value of type result, a
continuation, and a body function that maps a Control record to a
transactional computation. There are three ways in which a
transaction may be completed. First, the transaction may be abandoned
explicitly by a call to the abandon function supplied as part of the
Control record. In this case, the continuation is invoked on a pre-set
failure return value. Second, the transaction body runs to completion but
fails to commit. In this case, the continuation is also invoked on the
pre-set failure return value. Third, the transaction body runs to completion
and commits successfully. In this case, the continuation is invoked, but on
the pre-set success value.
The result-type argument initializes the default return value for both, the
success and the failure case. The body function implements the body of the
transaction.
|
|
data Control cgi result |
Constructors | Control | | abandon :: (result -> cgi ()) | abandon with result (rollback)
| setFail :: (result -> cgi ()) | set result on failure
| setCommit :: (result -> cgi ()) | set result on successful commit
|
|
|
|
|
data TCGI b a |
Type of a CGI action in a transactional scope with a result variable of
type a.
| Instances | |
|
|
Produced by Haddock version 0.8 |