TransAlt


Alt

first class cancellable async operations

Nested types and modules

TypeDescription
Alt<'s, 'r>

first class cancellable transactional async computation

AltQueryBuilder

imitating joinads

ChooseBuilder

nice syntax for choose

MergeBuilder

nice syntax for merge

StateChangeOp<'s, 'r>
Transaction<'s, 'r>

Transaction object represents current transaction state with a function for a result commit

TransactionBuilder

builder for transactional alternatives

TransactionResult<'r>

result of a transaction

Functions and values

Function or valueDescription
after ms v
Signature: ms:int -> v:'?7349 -> Alt<'?7350,'?7349>
Type parameters: '?7349, '?7350

commits value after a specified amount of time

always v
Signature: v:'?7296 -> Alt<'?7297,'?7296>
Type parameters: '?7296, '?7297

always commits success with a given value

asyncMap wrkfl f
Signature: wrkfl:Async<'?7274> -> f:('?7274 -> '?7275) -> Async<'?7275>
Type parameters: '?7274, '?7275

map ans async result

asyncReturn x
Signature: x:'?7272 -> Async<'?7272>
Type parameters: '?7272

simle async monad return

bind (one, f)
Signature: (one:Alt<'s,'a> * f:('a -> Alt<'s,'b>)) -> Alt<'s,'b>
Type parameters: 's, 'a, 'b

bind an alternative to an continuation

choose (one, two)
Signature: (one:Alt<'s,'r> * two:Alt<'s,'r>) -> Alt<'s,'r>
Type parameters: 's, 'r

Creates an alternative that is available when any one of the given alternatives is.

chooseB
Signature: ChooseBuilder
chooseXs xs
Signature: xs:seq<Alt<'?7352,'?7353>> -> Alt<'?7352,'?7353>
Type parameters: '?7352, '?7353

reduces seq of altrnatives with choose

delay f
Signature: f:(unit -> Async<Alt<'?7334,'?7335>>) -> Alt<'?7334,'?7335>
Type parameters: '?7334, '?7335
fromAsync wrkfl
Signature: wrkfl:Async<'r> -> Alt<'s,'r>
Type parameters: 'r, 's

creates an Alternative from a simple async workflow without onCommit or OnFiledCommit handlers

guard g
Signature: g:Async<Alt<'?7331,'?7332>> -> Alt<'?7331,'?7332>
Type parameters: '?7331, '?7332
ife (pred, thenAlt, elseAlt)
Signature: (pred:Alt<'?7337,bool> * thenAlt:Alt<'?7337,'?7338> * elseAlt:Alt<'?7337,'?7338>) -> Alt<'?7337,'?7338>
Type parameters: '?7337, '?7338
isMutatesState _arg1
Signature: _arg1:Alt<'?7264,'?7265> -> IsMutatesState
Type parameters: '?7264, '?7265

checks is current transaction can mutate state

isMutatesState2 (arg1, arg2)
Signature: (Alt<'?7267,'?7268> * Alt<'?7269,'?7270>) -> bool
Type parameters: '?7267, '?7268, '?7269, '?7270

checks is any of transactions can mutate state

map (alt, f)
Signature: (alt:Alt<'?7301,'?7302> * f:('?7302 -> '?7303)) -> Alt<'?7301,'?7303>
Type parameters: '?7301, '?7302, '?7303

maps a result of an alternative into other alternative

mapSt lens alt
Signature: lens:Lens<'?7367,'?7368> -> alt:Alt<'?7368,'?7369> -> Alt<'?7367,'?7369>
Type parameters: '?7367, '?7368, '?7369

map state

merge (one, two)
Signature: (one:Alt<'s,'a> * two:Alt<'s,'b>) -> Alt<'s,('a * 'b)>
Type parameters: 's, 'a, 'b

merges two alternatives into single one which returns both results as a tuple

mergeB
Signature: MergeBuilder
mergeChoose (one, two)
Signature: (one:Alt<'s,'r> * two:Alt<'s,'r2>) -> Alt<'s,('r * 'r2)>
Type parameters: 's, 'r, 'r2

merges two computations in differnet ways to find a way to execute them without blocking

mergeChooseXs xs
Signature: xs:seq<Alt<'s,'r>> -> Alt<'s,seq<'r>>
Type parameters: 's, 'r

reduces seq of altrnatives with mergeChoose

mergeXs xs
Signature: xs:seq<Alt<'s,'r>> -> Alt<'s,seq<'r>>
Type parameters: 's, 'r

reduces seq of altrnatives with merge

never ()
Signature: unit -> Alt<'?7305,'?7306>
Type parameters: '?7305, '?7306

never commits success

none ()
Signature: unit -> Alt<'?7340,'?7341 option>
Type parameters: '?7340, '?7341

returns alternative which returns None

pick state alt
Signature: state:'?7364 -> alt:Alt<'?7364,'?7365> -> Async<TransactionResult<'?7365>>
Type parameters: '?7364, '?7365

run altrnative and return result as an promise

pickWithResultState state alt
Signature: state:'?7361 -> alt:Alt<'?7361,'?7362> -> Async<TransactionResult<'?7362> * '?7361>
Type parameters: '?7361, '?7362

run altrnative and return result as an promise which will return result with a resulting state

queryB
Signature: AltQueryBuilder
run procId tran _arg1
Signature: procId:ProcessId -> tran:Transaction<'?7277,'?7278> -> _arg1:Alt<'?7277,'?7278> -> unit
Type parameters: '?7277, '?7278

run given computation in a given transaction asynchronously

shuffle s
Signature: s:seq<'?7375> -> seq<'?7375>
Type parameters: '?7375

randomly shuffle seq of alternatives

some alt
Signature: alt:Alt<'?7343,'?7344> -> Alt<'?7343,'?7344 option>
Type parameters: '?7343, '?7344

returns alternative which wraps returned result into a Some(v)

stateOp op
Signature: op:('?7371 -> OpResp<'?7371 * '?7372>) -> Alt<'?7371,'?7372>
Type parameters: '?7371, '?7372

alternative for a state operation execution

tranB
Signature: TransactionBuilder
tryFinally body compensation
Signature: body:Alt<'?7314,'?7315> -> compensation:(unit -> unit) -> Alt<'?7314,'?7315>
Type parameters: '?7314, '?7315

try finally alternative for builder

tryWith body compensation
Signature: body:Alt<'?7311,'?7312> -> compensation:(Exception -> Alt<'?7311,'?7312>) -> Alt<'?7311,'?7312>
Type parameters: '?7311, '?7312

try with alternative for builder

unit ()
Signature: unit -> Alt<'?7299,unit>
Type parameters: '?7299

always commits success with unit

where (alt, f)
Signature: (alt:Alt<'?7346,'?7347> * f:('?7347 -> bool)) -> Alt<'?7346,'?7347>
Type parameters: '?7346, '?7347

commits result only if alt commits a value which is f(value) = true

whileLoop guard body
Signature: guard:(unit -> bool) -> body:Alt<'?7308,'?7309> -> Alt<'?7308,unit>
Type parameters: '?7308, '?7309

whileLoop alternaive for builder

withAck builder
Signature: builder:(Alt<'s,bool> -> Async<Alt<'s,'r>>) -> Alt<'s,'r>
Type parameters: 's, 'r

uses a alternative builder function for alternative creation with specified handlers on commit or commit failure

wrap (alt, f)
Signature: (alt:Alt<'?7328,'?7329> * f:(TransactionResult<'?7329> -> unit)) -> Alt<'?7328,'?7329>
Type parameters: '?7328, '?7329

attahes an on success handler

Fork me on GitHub