identity(value: Text) (out: Text) { out = value } size(value: Text) (out: Int) { out = length(value) } pair(value: Int) (left: Int, right: Int) { left = value right = value + 1 } flow text(value: Text) (out: Text) | step | kind | do | | out | calc | parallel(identity(value)) | flow borrowed(value: Text) (out: Int) | step | kind | do | | out | calc | parallel(size(value)) | flow multiple(value: Int) (out: Int) | step | kind | do | | received | calc | parallel(pair(value)) | | out | calc | received.left + received.right | flow apply(value: Int, action: handler(value: Int) (left: Int, right: Int)) (out: Int) | step | kind | do | | received | calc | parallel(action(value)) | | out | calc | received.left + received.right | flow handled() (out: Int) | step | kind | do | | out | flow | apply(20, pair) | flow together() (out: Int) | step | kind | parallel | do | | a | calc | calculate | parallel(pair(10)) | | b | calc | calculate | parallel(pair(20)) | | out | calc | - | a.left + a.right + b.left + b.right | type Problem { error Invalid } guard(value: Int) (out: Int) { check value > 0 else Problem.Invalid out = value } alwaysFail() (out: Int) { out = fail(Problem.Invalid) } type Attempt { Done(value: Int), error Failed(reason: Problem) } rule resolve(value: Attempt) (out: Int) recover("report a rejected input as -1") | value | out | | Done(number) | number | | Failed(reason) | -1 | flow captured(value: Int) (out: Int) | step | kind | do | | attempt: Attempt | calc | result(parallel(guard(value))) | | out | rule | resolve(attempt) | flow argumentFailure(value: Int) (out: Int) | step | kind | do | | attempt: Attempt | calc | result(parallel(guard(guard(value)))) | | out | rule | resolve(attempt) | flow neverReturns() (out: Int) | step | kind | do | | out | calc | parallel(alwaysFail()) | flow capturedNever() (out: Int) | step | kind | do | | attempt: Attempt | calc | result(parallel(alwaysFail())) | | out | rule | resolve(attempt) | flow child(value: Int) (out: Int) | step | kind | do | | out | calc | parallel(guard(value)) | fallback() (out: Int) { out = 0 } flow nested(value: Int) (out: Int) | step | kind | do | | out | calc | timeout(run(child(value)), 60000, fallback) | cmd together = together