temporal-sdk
Safe HaskellNone
LanguageHaskell2010

Temporal.Workflow

Description

This module provides the core functionality for defining functions that can be executed as Temporal workflows.

In day-to-day conversations, the term Workflow frequently denotes either a Workflow Type, a Workflow Definition, or a Workflow Execution.

What is a Workflow Definition?

A Workflow Definition is the code that defines the constraints of a Workflow Execution.

A Workflow Definition is often also referred to as a Workflow Function. In Temporal's documentation, a Workflow Definition refers to the source for the instance of a Workflow Execution, while a Workflow Function refers to the source for the instance of a Workflow Function Execution.

A Workflow Execution effectively executes once to completion, while a Workflow Function Execution occurs many times during the life of a Workflow Execution.

Deterministic constraints

A critical aspect of developing Workflow Definitions is ensuring they exhibit certain deterministic traits – that is, making sure that the same Commands are emitted in the same sequence, whenever a corresponding Workflow Function Execution (instance of the Function Definition) is re-executed.

The execution semantics of a Workflow Execution include the re-execution of a Workflow Function, which is called a Replay. The use of Workflow APIs in the function is what generates Commands. Commands tell the Cluster which Events to create and add to the Workflow Execution's Event History. When a Workflow Function executes, the Commands that are emitted are compared with the existing Event History. If a corresponding Event already exists within the Event History that maps to the generation of that Command in the same sequence, and some specific metadata of that Command matches with some specific metadata of the Event, then the Function Execution progresses.

For example, using an SDK's "Execute Activity" API generates the ScheduleActivityTask Command. When this API is called upon re-execution, that Command is compared with the Event that is in the same location within the sequence. The Event in the sequence must be an ActivityTaskScheduled Event, where the Activity name is the same as what is in the Command.

If a generated Command doesn't match what it needs to in the existing Event History, then the Workflow Execution returns a non-deterministic error.

The following are the two reasons why a Command might be generated out of sequence or the wrong Command might be generated altogether:

  • Code changes are made to a Workflow Definition that is in use by a running Workflow Execution.
  • There is intrinsic non-deterministic logic (such as inline random branching).

Code changes can cause non-deterministic behavior

The Workflow Definition can change in very limited ways once there is a Workflow Execution depending on it. To alleviate non-deterministic issues that arise from code changes, we recommend using Workflow Versioning.

For example, let's say we have a Workflow Definition that defines the following sequence:

  1. Start and wait on a Timer/sleep.
  2. Spawn and wait on an Activity Execution.
  3. Complete.

We start a Worker and spawn a Workflow Execution that uses that Workflow Definition. The Worker would emit the StartTimer Command and the Workflow Execution would become suspended.

Before the Timer is up, we change the Workflow Definition to the following sequence:

  1. Spawn and wait on an Activity Execution.
  2. Start and wait on a Timer/sleep.
  3. Complete.

When the Timer fires, the next Workflow Task will cause the Workflow Function to re-execute. The first Command the Worker sees would be ScheduleActivityTask Command, which wouldn't match up to the expected TimerStarted Event.

The Workflow Execution would fail and return a non-deterministic error.

The following are examples of minor changes that would not result in non-determinism errors when re-executing a History which already contain the Events:

  • Changing the duration of a Timer
  • Changing the arguments to:

    • The Activity Options in a call to spawn an Activity Execution (local or nonlocal).
    • The Child Workflow Options in a call to spawn a Child Workflow Execution.
    • Call to Signal an External Workflow Execution.
  • Adding a Signal Handler for a Signal Type that has not been sent to this Workflow Execution.

Workflow Versioning

Note: not yet implemented

The Workflow Versioning feature enables the creation of logical branching inside a Workflow Definition based on a developer specified version identifier. This feature is useful for Workflow Definition logic needs to be updated, but there are running Workflow Executions that currently depends on it. It is important to note that a practical way to handle different versions of Workflow Definitions, without using the versioning API, is to run the different versions on separate Task Queues.

Handling unreliable Worker Processes

You do not handle Worker Process failure or restarts in a Workflow Definition.

Workflow Function Executions are completely oblivious to the Worker Process in terms of failures or downtime. The Temporal Platform ensures that the state of a Workflow Execution is recovered and progress resumes if there is an outage of either Worker Processes or the Temporal Cluster itself. The only reason a Workflow Execution might fail is due to the code throwing an error or exception, not because of underlying infrastructure outages.

Synopsis

Documentation

data Workflow a Source #

The Workflow monad is a constrained execution environment that helps developers write code that can be executed deterministically and reliably.

If a Workflow execution is interrupted, for example due to a server failure, or otherwise fails to complete, the Temporal service will automatically replay the Workflow execution up to the point of interruption with the same inputs at each step in the function.

The st state may be used to store information that is needed to respond to any queries or signals that are received by the Workflow execution.

Workflow code must be deterministic. This means:

  • no threading
  • no randomness
  • no external calls to processes
  • no network I/O
  • no global state mutation
  • no system date or time

This might seem like a lot of restrictions, but Temporal provides a number of functions that allow you to use similar functionality in a deterministic way.

A critical aspect of developing Workflow Definitions is ensuring they exhibit certain deterministic traits – that is, making sure that the same Commands are emitted in the same sequence, whenever a corresponding Workflow Function Execution (instance of the Function Definition) is re-executed.

Instances

Instances details
(TypeError ('Text "A workflow definition cannot directly perform IO. Use executeActivity or executeLocalActivity instead.") :: Constraint) => MonadIO Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

liftIO :: IO a -> Workflow a #

MonadCatch Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

catch :: (HasCallStack, Exception e) => Workflow a -> (e -> Workflow a) -> Workflow a #

MonadThrow Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

throwM :: (HasCallStack, Exception e) => e -> Workflow a #

Alternative Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

empty :: Workflow a #

(<|>) :: Workflow a -> Workflow a -> Workflow a #

some :: Workflow a -> Workflow [a] #

many :: Workflow a -> Workflow [a] #

Applicative Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

pure :: a -> Workflow a #

(<*>) :: Workflow (a -> b) -> Workflow a -> Workflow b #

liftA2 :: (a -> b -> c) -> Workflow a -> Workflow b -> Workflow c #

(*>) :: Workflow a -> Workflow b -> Workflow b #

(<*) :: Workflow a -> Workflow b -> Workflow a #

Functor Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

fmap :: (a -> b) -> Workflow a -> Workflow b #

(<$) :: a -> Workflow b -> Workflow a #

Monad Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

(>>=) :: Workflow a -> (a -> Workflow b) -> Workflow b #

(>>) :: Workflow a -> Workflow b -> Workflow b #

return :: a -> Workflow a #

MonadLogger Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Workflow () #

MonadReadStateVar Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

MonadWriteStateVar Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

writeStateVar :: StateVar a -> a -> Workflow () Source #

modifyStateVar :: StateVar a -> (a -> a) -> Workflow () Source #

(TypeError ('Text "A workflow definition cannot directly perform IO. Use executeActivity or executeLocalActivity instead.") :: Constraint) => MonadUnliftIO Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

withRunInIO :: ((forall a. Workflow a -> IO a) -> IO b) -> Workflow b #

FrozenGen StdGen Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Associated Types

type MutableGen StdGen Workflow 
Instance details

Defined in Temporal.Workflow.Internal.Monad

StatefulGen WorkflowGenM Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

RandomGenM WorkflowGenM StdGen Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

applyRandomGenM :: (StdGen -> (a, StdGen)) -> WorkflowGenM -> Workflow a #

(FunctionSupportsCodec' Workflow codec original, (Def env @@ original) ~ WorkflowDefinition) => DefFromFunction' codec env (Workflow result) original Source # 
Instance details

Defined in Temporal.Bundle

Methods

defFromFunction :: Proxy (Workflow result) -> codec -> String -> original -> Def env @@ original Source #

(FunctionSupportsCodec' Workflow codec original, (Ref @@ original) ~ KnownWorkflow (ArgsOf original) (ResultOf Workflow original)) => RefFromFunction' codec (Workflow result) original Source # 
Instance details

Defined in Temporal.Bundle

Methods

refFromFunction :: Proxy (Workflow result) -> codec -> String -> Proxy original -> Ref @@ original Source #

Monoid a => Monoid (Workflow a) Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

mempty :: Workflow a #

mappend :: Workflow a -> Workflow a -> Workflow a #

mconcat :: [Workflow a] -> Workflow a #

Semigroup a => Semigroup (Workflow a) Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

(<>) :: Workflow a -> Workflow a -> Workflow a #

sconcat :: NonEmpty (Workflow a) -> Workflow a #

stimes :: Integral b => b -> Workflow a -> Workflow a #

FieldToStartOptionDefaults (Workflow a) Source # 
Instance details

Defined in Temporal.Bundle

type MutableGen StdGen Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

data WorkflowDefinition Source #

This is a Workflow function that can be called from the outside world.

You can create a definition via provideWorkflow.

To make a worker use this definition, you must add it to the WorkerConfig via addWorkflow.

data KnownWorkflow (args :: [Type]) result Source #

A KnownWorkflow is a handle that contains all the information needed to start a Workflow either as a child workflow or as a top-level workflow via a Client.

Constructors

FunctionSupportsCodec codec args result => KnownWorkflow 

Instances

Instances details
UseAsInWorkflowProxy ProxyAsync (KnownWorkflow args res) Source # 
Instance details

Defined in Temporal.Bundle

UseAsInWorkflowProxy ProxySync (KnownWorkflow args res) Source # 
Instance details

Defined in Temporal.Bundle

FieldToStartOptionDefaults (KnownWorkflow args res) Source # 
Instance details

Defined in Temporal.Bundle

WorkflowRef (KnownWorkflow args result) Source # 
Instance details

Defined in Temporal.Workflow.Definition

Associated Types

type WorkflowArgs (KnownWorkflow args result) 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowArgs (KnownWorkflow args result) = args
type WorkflowResult (KnownWorkflow args result) 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowResult (KnownWorkflow args result) = result

Methods

workflowRef :: KnownWorkflow args result -> KnownWorkflow (WorkflowArgs (KnownWorkflow args result)) (WorkflowResult (KnownWorkflow args result)) Source #

type Eval (InWorkflowProxies ProxyAsync (KnownWorkflow args res) :: Type -> Type) Source # 
Instance details

Defined in Temporal.Bundle

type Eval (InWorkflowProxies ProxySync (KnownWorkflow args res) :: Type -> Type) Source # 
Instance details

Defined in Temporal.Bundle

type Eval (InWorkflowProxies ProxySync (KnownWorkflow args res) :: Type -> Type) = args :->: Workflow res
type WorkflowArgs (KnownWorkflow args result) Source # 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowArgs (KnownWorkflow args result) = args
type WorkflowResult (KnownWorkflow args result) Source # 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowResult (KnownWorkflow args result) = result

provideWorkflow :: forall codec f. (f ~ (ArgsOf f :->: Workflow (ResultOf Workflow f)), FunctionSupportsCodec codec (ArgsOf f) (ResultOf Workflow f)) => codec -> Text -> (RequireCallStackImpl => f) -> ProvidedWorkflow f Source #

A utility function for constructing a WorkflowDefinition from a function as well as a KnownWorkflow value. This is useful for keeping the argument, codec, and result types in sync with each other so that changes to the function are reflected at their use sites.

myWorkflow :: Workflow () () Int
myWorkflow = pure 1

myWorkflowDef :: ProvidedWorkflow () () Int
myWorkflowDef = provideWorkflow
  JSON -- codec
  @"myWorkflow" -- visible name of the workflow
  () -- initial state
  myWorkflow -- the workflow function

data Task a Source #

An async action handle that can be awaited or cancelled.

Instances

Instances details
Applicative Task Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

pure :: a -> Task a #

(<*>) :: Task (a -> b) -> Task a -> Task b #

liftA2 :: (a -> b -> c) -> Task a -> Task b -> Task c #

(*>) :: Task a -> Task b -> Task b #

(<*) :: Task a -> Task b -> Task a #

Functor Task Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

fmap :: (a -> b) -> Task a -> Task b #

(<$) :: a -> Task b -> Task a #

Cancel (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type CancelResult (Task a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type CancelResult (Task a) = Workflow ()

Methods

cancel :: Task a -> CancelResult (Task a) Source #

Wait (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type WaitResult (Task a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type WaitResult (Task a) = Workflow a

Methods

wait :: Task a -> WaitResult (Task a) Source #

type CancelResult (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type CancelResult (Task a) = Workflow ()
type WaitResult (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type WaitResult (Task a) = Workflow a

newtype StartToClose Source #

An Activity Execution must have either this timeout (Start-To-Close) or the Schedule-To-Close Timeout set. We recommend always setting this timeout; however, make sure that Start-To-Close Timeout is always set to be longer than the maximum possible time for the Activity Execution to complete. For long running Activity Executions, we recommend also using Activity Heartbeats and Heartbeat Timeouts.

Tip: We strongly recommend setting a Start-To-Close Timeout.

The Temporal Server doesn't detect failures when a Worker loses communication with the Server or crashes. Therefore, the Temporal Server relies on the Start-To-Close Timeout to force Activity retries.

Constructors

StartToClose Duration 

Instances

Instances details
Data StartToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> StartToClose -> c StartToClose #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c StartToClose #

toConstr :: StartToClose -> Constr #

dataTypeOf :: StartToClose -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c StartToClose) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c StartToClose) #

gmapT :: (forall b. Data b => b -> b) -> StartToClose -> StartToClose #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> StartToClose -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> StartToClose -> r #

gmapQ :: (forall d. Data d => d -> u) -> StartToClose -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> StartToClose -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> StartToClose -> m StartToClose #

Show StartToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Eq StartToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Ord StartToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

StartActivityTimeoutOption StartToClose Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift StartToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Methods

lift :: Quote m => StartToClose -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => StartToClose -> Code m StartToClose #

StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

newtype ScheduleToClose Source #

A Schedule-To-Close Timeout is the maximum amount of time allowed for the overall Activity Execution, from when the first Activity Task is scheduled to when the last Activity Task, in the chain of Activity Tasks that make up the Activity Execution, reaches a Closed status.

An Activity Execution must have either this timeout (Schedule-To-Close) or Start-To-Close set. By default, an Activity Execution Retry Policy dictates that retries occur for up to 10 years. This timeout can be used to control the overall duration of an Activity Execution in the face of failures (repeated Activity Task Executions), without altering the Maximum Attempts field of the Retry Policy.

Instances

Instances details
Data ScheduleToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ScheduleToClose -> c ScheduleToClose #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ScheduleToClose #

toConstr :: ScheduleToClose -> Constr #

dataTypeOf :: ScheduleToClose -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ScheduleToClose) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ScheduleToClose) #

gmapT :: (forall b. Data b => b -> b) -> ScheduleToClose -> ScheduleToClose #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ScheduleToClose -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ScheduleToClose -> r #

gmapQ :: (forall d. Data d => d -> u) -> ScheduleToClose -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ScheduleToClose -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ScheduleToClose -> m ScheduleToClose #

Show ScheduleToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Eq ScheduleToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Ord ScheduleToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

StartActivityTimeoutOption ScheduleToClose Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift ScheduleToClose Source # 
Instance details

Defined in Temporal.Common.TimeoutType

Methods

lift :: Quote m => ScheduleToClose -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => ScheduleToClose -> Code m ScheduleToClose #

StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

data These a b #

The These type represents values with two non-exclusive possibilities.

This can be useful to represent combinations of two values, where the combination is defined if either input is. Algebraically, the type These A B represents (A + B + AB), which doesn't factor easily into sums and products--a type like Either A (B, Maybe A) is unclear and awkward to use.

These has straightforward instances of Functor, Monad, &c., and behaves like a hybrid error/writer monad, as would be expected.

For zipping and unzipping of structures with These values, see Data.Align.

Constructors

This a 
That b 
These a b 

Instances

Instances details
FromJSON2 These

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (These a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [These a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (These a b) #

ToJSON2 These

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> These a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [These a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> These a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [These a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> These a b -> Bool #

Assoc These

Since: these-0.8

Instance details

Defined in Data.These

Methods

assoc :: These (These a b) c -> These a (These b c) #

unassoc :: These a (These b c) -> These (These a b) c #

Swap These

Since: these-0.8

Instance details

Defined in Data.These

Methods

swap :: These a b -> These b a #

Bifoldable These 
Instance details

Defined in Data.These

Methods

bifold :: Monoid m => These m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> These a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> These a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> These a b -> c #

Bifoldable1 These

Since: these-1.2

Instance details

Defined in Data.These

Methods

bifold1 :: Semigroup m => These m m -> m #

bifoldMap1 :: Semigroup m => (a -> m) -> (b -> m) -> These a b -> m #

Bifunctor These 
Instance details

Defined in Data.These

Methods

bimap :: (a -> b) -> (c -> d) -> These a c -> These b d #

first :: (a -> b) -> These a c -> These b c #

second :: (b -> c) -> These a b -> These a c #

Bitraversable These 
Instance details

Defined in Data.These

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> These a b -> f (These c d) #

Eq2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> These a c -> These b d -> Bool #

Ord2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> These a c -> These b d -> Ordering #

Read2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (These a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [These a b] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (These a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [These a b] #

Show2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> These a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [These a b] -> ShowS #

NFData2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> These a b -> () #

Hashable2 These

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> These a b -> Int #

Generic1 (These a :: Type -> Type) 
Instance details

Defined in Data.These

Associated Types

type Rep1 (These a :: Type -> Type) 
Instance details

Defined in Data.These

Methods

from1 :: These a a0 -> Rep1 (These a) a0 #

to1 :: Rep1 (These a) a0 -> These a a0 #

FromJSON a => FromJSON1 (These a)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (These a a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [These a a0] #

liftOmittedField :: Maybe a0 -> Maybe (These a a0) #

ToJSON a => ToJSON1 (These a)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> These a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [These a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> These a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [These a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> These a a0 -> Bool #

Eq a => Eq1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftEq :: (a0 -> b -> Bool) -> These a a0 -> These a b -> Bool #

Ord a => Ord1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftCompare :: (a0 -> b -> Ordering) -> These a a0 -> These a b -> Ordering #

Read a => Read1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (These a a0) #

liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [These a a0] #

liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (These a a0) #

liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [These a a0] #

Show a => Show1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> These a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [These a a0] -> ShowS #

NFData a => NFData1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftRnf :: (a0 -> ()) -> These a a0 -> () #

Semigroup a => Applicative (These a) 
Instance details

Defined in Data.These

Methods

pure :: a0 -> These a a0 #

(<*>) :: These a (a0 -> b) -> These a a0 -> These a b #

liftA2 :: (a0 -> b -> c) -> These a a0 -> These a b -> These a c #

(*>) :: These a a0 -> These a b -> These a b #

(<*) :: These a a0 -> These a b -> These a a0 #

Functor (These a) 
Instance details

Defined in Data.These

Methods

fmap :: (a0 -> b) -> These a a0 -> These a b #

(<$) :: a0 -> These a b -> These a a0 #

Semigroup a => Monad (These a) 
Instance details

Defined in Data.These

Methods

(>>=) :: These a a0 -> (a0 -> These a b) -> These a b #

(>>) :: These a a0 -> These a b -> These a b #

return :: a0 -> These a a0 #

Foldable (These a) 
Instance details

Defined in Data.These

Methods

fold :: Monoid m => These a m -> m #

foldMap :: Monoid m => (a0 -> m) -> These a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> These a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> These a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> These a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> These a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> These a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 #

toList :: These a a0 -> [a0] #

null :: These a a0 -> Bool #

length :: These a a0 -> Int #

elem :: Eq a0 => a0 -> These a a0 -> Bool #

maximum :: Ord a0 => These a a0 -> a0 #

minimum :: Ord a0 => These a a0 -> a0 #

sum :: Num a0 => These a a0 -> a0 #

product :: Num a0 => These a a0 -> a0 #

Traversable (These a) 
Instance details

Defined in Data.These

Methods

traverse :: Applicative f => (a0 -> f b) -> These a a0 -> f (These a b) #

sequenceA :: Applicative f => These a (f a0) -> f (These a a0) #

mapM :: Monad m => (a0 -> m b) -> These a a0 -> m (These a b) #

sequence :: Monad m => These a (m a0) -> m (These a a0) #

Hashable a => Hashable1 (These a)

Since: these-1.1.1

Instance details

Defined in Data.These

Methods

liftHashWithSalt :: (Int -> a0 -> Int) -> Int -> These a a0 -> Int #

(FromJSON a, FromJSON b) => FromJSON (These a b)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(ToJSON a, ToJSON b) => ToJSON (These a b)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: These a b -> Value #

toEncoding :: These a b -> Encoding #

toJSONList :: [These a b] -> Value #

toEncodingList :: [These a b] -> Encoding #

omitField :: These a b -> Bool #

(Binary a, Binary b) => Binary (These a b)

Since: these-0.7.1

Instance details

Defined in Data.These

Methods

put :: These a b -> Put #

get :: Get (These a b) #

putList :: [These a b] -> Put #

(NFData a, NFData b) => NFData (These a b)

Since: these-0.7.1

Instance details

Defined in Data.These

Methods

rnf :: These a b -> () #

(Semigroup a, Semigroup b) => Semigroup (These a b) 
Instance details

Defined in Data.These

Methods

(<>) :: These a b -> These a b -> These a b #

sconcat :: NonEmpty (These a b) -> These a b #

stimes :: Integral b0 => b0 -> These a b -> These a b #

(Data a, Data b) => Data (These a b) 
Instance details

Defined in Data.These

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> These a b -> c (These a b) #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (These a b) #

toConstr :: These a b -> Constr #

dataTypeOf :: These a b -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (These a b)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (These a b)) #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> These a b -> These a b #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> These a b -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> These a b -> r #

gmapQ :: (forall d. Data d => d -> u) -> These a b -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> These a b -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> These a b -> m (These a b) #

Generic (These a b) 
Instance details

Defined in Data.These

Associated Types

type Rep (These a b) 
Instance details

Defined in Data.These

Methods

from :: These a b -> Rep (These a b) x #

to :: Rep (These a b) x -> These a b #

(Read a, Read b) => Read (These a b) 
Instance details

Defined in Data.These

(Show a, Show b) => Show (These a b) 
Instance details

Defined in Data.These

Methods

showsPrec :: Int -> These a b -> ShowS #

show :: These a b -> String #

showList :: [These a b] -> ShowS #

(Eq a, Eq b) => Eq (These a b) 
Instance details

Defined in Data.These

Methods

(==) :: These a b -> These a b -> Bool #

(/=) :: These a b -> These a b -> Bool #

(Ord a, Ord b) => Ord (These a b) 
Instance details

Defined in Data.These

Methods

compare :: These a b -> These a b -> Ordering #

(<) :: These a b -> These a b -> Bool #

(<=) :: These a b -> These a b -> Bool #

(>) :: These a b -> These a b -> Bool #

(>=) :: These a b -> These a b -> Bool #

max :: These a b -> These a b -> These a b #

min :: These a b -> These a b -> These a b #

(Hashable a, Hashable b) => Hashable (These a b) 
Instance details

Defined in Data.These

Methods

hashWithSalt :: Int -> These a b -> Int #

hash :: These a b -> Int #

type Rep1 (These a :: Type -> Type) 
Instance details

Defined in Data.These

type Rep (These a b) 
Instance details

Defined in Data.These

Workflow monad operations

Activity operations

An Activity is an IO-based function that executes a single, well-defined action (either short or long running), such as calling another service, transcoding a media file, or sending an email message. Activity code can be non-deterministic.

We recommend that it be idempotent.

Workflow code orchestrates the execution of Activities, persisting the results. If an Activity Function Execution fails, any future execution starts from initial state (except Heartbeats).

Activity Functions are executed by Worker Processes. When the Activity Function returns, the Worker sends the results back to the Temporal Cluster as part of the ActivityTaskCompleted Event. The Event is added to the Workflow Execution's Event History.

class ActivityRef f where Source #

Associated Types

type ActivityArgs f :: [Type] Source #

type ActivityResult f Source #

Instances

Instances details
(Fn f, ActivityFn f) => ActivityRef (ActivityImpl f) Source # 
Instance details

Defined in Temporal.TH.Classes

Associated Types

type ActivityArgs (ActivityImpl f) 
Instance details

Defined in Temporal.TH.Classes

type ActivityResult (ActivityImpl f) 
Instance details

Defined in Temporal.TH.Classes

(TypeError DirectActivityReferenceMsg :: Constraint) => ActivityRef (Activity env a) Source # 
Instance details

Defined in Temporal.Activity.Definition

Associated Types

type ActivityArgs (Activity env a) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityArgs (Activity env a) = '[] :: [Type]
type ActivityResult (Activity env a) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (Activity env a) = a
VarArgs args => ActivityRef (KnownActivity args result) Source # 
Instance details

Defined in Temporal.Activity.Definition

Associated Types

type ActivityArgs (KnownActivity args result) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityArgs (KnownActivity args result) = args
type ActivityResult (KnownActivity args result) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (KnownActivity args result) = result

Methods

activityRef :: KnownActivity args result -> KnownActivity (ActivityArgs (KnownActivity args result)) (ActivityResult (KnownActivity args result)) Source #

ActivityRef (ProvidedActivity env f) Source # 
Instance details

Defined in Temporal.Activity.Definition

Associated Types

type ActivityArgs (ProvidedActivity env f) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (ProvidedActivity env f) 
Instance details

Defined in Temporal.Activity.Definition

(f ~ (ArgsOf f :->: Activity env (ResultOf (Activity env) f)), TypeError DirectActivityReferenceMsg :: Constraint) => ActivityRef (a -> f) Source # 
Instance details

Defined in Temporal.Activity.Definition

Associated Types

type ActivityArgs (a -> f) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityArgs (a -> f) = '[] :: [Type]
type ActivityResult (a -> f) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (a -> f) = ()

Methods

activityRef :: (a -> f) -> KnownActivity (ActivityArgs (a -> f)) (ActivityResult (a -> f)) Source #

data KnownActivity (args :: [Type]) result Source #

Constructors

FunctionSupportsCodec codec args result => KnownActivity 

Instances

Instances details
VarArgs args => UseAsInWorkflowProxy ProxyAsync (KnownActivity args res) Source # 
Instance details

Defined in Temporal.Bundle

VarArgs args => UseAsInWorkflowProxy ProxySync (KnownActivity args res) Source # 
Instance details

Defined in Temporal.Bundle

VarArgs args => ActivityRef (KnownActivity args result) Source # 
Instance details

Defined in Temporal.Activity.Definition

Associated Types

type ActivityArgs (KnownActivity args result) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityArgs (KnownActivity args result) = args
type ActivityResult (KnownActivity args result) 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (KnownActivity args result) = result

Methods

activityRef :: KnownActivity args result -> KnownActivity (ActivityArgs (KnownActivity args result)) (ActivityResult (KnownActivity args result)) Source #

FieldToStartOptionDefaults (KnownActivity args res) Source # 
Instance details

Defined in Temporal.Bundle

type Eval (InWorkflowProxies ProxyAsync (KnownActivity args res) :: Type -> Type) Source # 
Instance details

Defined in Temporal.Bundle

type Eval (InWorkflowProxies ProxySync (KnownActivity args res) :: Type -> Type) Source # 
Instance details

Defined in Temporal.Bundle

type Eval (InWorkflowProxies ProxySync (KnownActivity args res) :: Type -> Type) = args :->: Workflow res
type ActivityArgs (KnownActivity args result) Source # 
Instance details

Defined in Temporal.Activity.Definition

type ActivityArgs (KnownActivity args result) = args
type ActivityResult (KnownActivity args result) Source # 
Instance details

Defined in Temporal.Activity.Definition

type ActivityResult (KnownActivity args result) = result

data StartActivityOptions Source #

Constructors

StartActivityOptions 

Fields

  • activityId :: Maybe ActivityId

    The identifier for an Activity Execution. The identifier can be generated by the system, or it can be provided by the Workflow code that spawns the Activity Execution. The identifier is unique among the open Activity Executions of a Workflow Run. (A single Workflow Run may reuse an Activity Id if an earlier Activity Execution with the same Id has closed.)

    An Activity Id can be used to complete the Activity asynchronously.

  • taskQueue :: Maybe TaskQueue
     
  • timeout :: ActivityTimeoutPolicy
     
  • scheduleToStartTimeout :: Maybe Duration

    A Schedule-To-Start Timeout is the maximum amount of time that is allowed from when an Activity Task is scheduled (that is, placed in a Task Queue) to when a Worker starts (that is, picks up from the Task Queue) that Activity Task. In other words, it's a limit for how long an Activity Task can be enqueued.

  • heartbeatTimeout :: Maybe Duration

    A Heartbeat Timeout is the maximum time between Activity Heartbeats. If this timeout is reached, the Activity Task fails and a retry occurs if a Retry Policy dictates it.

  • retryPolicy :: Maybe RetryPolicy

    A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience.

    A Retry Policy is a collection of attributes that instructs the Temporal Server how to retry a failure of a Workflow Execution or an Activity Task Execution. (Retry Policies do not apply to Workflow Task Executions, which always retry indefinitely.)

  • cancellationType :: ActivityCancellationType
     
  • headers :: Map Text Payload
     
  • disableEagerExecution :: Bool

    If true, will disable eager activity execution. Eager activity execution is an optimization on some servers that sends activities back to the same worker as the calling workflow if they can run there. This setting is experimental and may be removed in a future release.

data ActivityCancellationType Source #

Defines how the workflow will wait (or not) for cancellation of the activity to be confirmed.

Constructors

ActivityCancellationTryCancel

Initiate a cancellation request and immediately report cancellation to the workflow.

ActivityCancellationWaitCancellationCompleted

Wait for activity cancellation completion. Note that activity must heartbeat to receive a cancellation notification. This can block the cancellation for a long time if activity doesn't heartbeat or chooses to ignore the cancellation request.

ActivityCancellationAbandon

Do not request cancellation of the activity and immediately report cancellation to the workflow

Instances

Instances details
Data ActivityCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ActivityCancellationType -> c ActivityCancellationType #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ActivityCancellationType #

toConstr :: ActivityCancellationType -> Constr #

dataTypeOf :: ActivityCancellationType -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ActivityCancellationType) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ActivityCancellationType) #

gmapT :: (forall b. Data b => b -> b) -> ActivityCancellationType -> ActivityCancellationType #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ActivityCancellationType -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ActivityCancellationType -> r #

gmapQ :: (forall d. Data d => d -> u) -> ActivityCancellationType -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ActivityCancellationType -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityCancellationType -> m ActivityCancellationType #

Show ActivityCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Eq ActivityCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift ActivityCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

data ActivityTimeoutPolicy Source #

Instances

Instances details
Data ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ActivityTimeoutPolicy -> c ActivityTimeoutPolicy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ActivityTimeoutPolicy #

toConstr :: ActivityTimeoutPolicy -> Constr #

dataTypeOf :: ActivityTimeoutPolicy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ActivityTimeoutPolicy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ActivityTimeoutPolicy) #

gmapT :: (forall b. Data b => b -> b) -> ActivityTimeoutPolicy -> ActivityTimeoutPolicy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ActivityTimeoutPolicy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ActivityTimeoutPolicy -> r #

gmapQ :: (forall d. Data d => d -> u) -> ActivityTimeoutPolicy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ActivityTimeoutPolicy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ActivityTimeoutPolicy -> m ActivityTimeoutPolicy #

Show ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Eq ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

class StartActivityTimeoutOption a where Source #

Instances

Instances details
StartActivityTimeoutOption ScheduleToClose Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption StartToClose Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption ActivityTimeoutPolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (Either ScheduleToClose StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (Either StartToClose ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (ScheduleToClose, StartToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

StartActivityTimeoutOption (StartToClose, ScheduleToClose) Source # 
Instance details

Defined in Temporal.Workflow.Types

data StartLocalActivityOptions Source #

Constructors

StartLocalActivityOptions 

Fields

  • activityId :: Maybe ActivityId
     
  • scheduleToCloseTimeout :: Maybe Duration

    Indicates how long the caller is willing to wait for local activity completion. Limits how long retries will be attempted. When not specified defaults to the workflow execution timeout (which may be unset).

  • scheduleToStartTimeout :: Maybe Duration

    Limits time the local activity can idle internally before being executed. That can happen if the worker is currently at max concurrent local activity executions. This timeout is always non retryable as all a retry would achieve is to put it back into the same queue. Defaults to schedule_to_close_timeout if not specified and that is set. Must be <= schedule_to_close_timeout when set, otherwise, it will be clamped down.

  • startToCloseTimeout :: Maybe Duration

    Maximum time the local activity is allowed to execute after the task is dispatched. This timeout is always retryable. Either or both of schedule_to_close_timeout and this must be specified. If set, this must be <= schedule_to_close_timeout, otherwise, it will be clamped down.

  • retryPolicy :: Maybe RetryPolicy

    Specify a retry policy for the local activity. By default local activities will be retried indefinitely.

  • localRetryThreshold :: Maybe Duration

    If the activity is retrying and backoff would exceed this value, lang will be told to schedule a timer and retry the activity after. Otherwise, backoff will happen internally in core. Defaults to 1 minute.

  • cancellationType :: ActivityCancellationType

    Defines how the workflow will wait (or not) for cancellation of the activity to be confirmed. Lang should default this to WAIT_CANCELLATION_COMPLETED, even though proto will default to TRY_CANCEL automatically.

  • headers :: Map Text Payload
     

Child workflow operations

A Child Workflow Execution is a Workflow Execution that is spawned from within another Workflow.

A Workflow Execution can be both a Parent and a Child Workflow Execution because any Workflow can spawn another Workflow.

class WorkflowRef f where Source #

Associated Types

type WorkflowArgs f :: [Type] Source #

type WorkflowResult f Source #

Instances

Instances details
(Fn f, WorkflowFn f) => WorkflowRef (WorkflowImpl f) Source # 
Instance details

Defined in Temporal.TH.Classes

Associated Types

type WorkflowArgs (WorkflowImpl f) 
Instance details

Defined in Temporal.TH.Classes

type WorkflowResult (WorkflowImpl f) 
Instance details

Defined in Temporal.TH.Classes

VarArgs (ArgsOf f) => WorkflowRef (ProvidedWorkflow f) Source # 
Instance details

Defined in Temporal.Workflow.Definition

WorkflowRef (KnownWorkflow args result) Source # 
Instance details

Defined in Temporal.Workflow.Definition

Associated Types

type WorkflowArgs (KnownWorkflow args result) 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowArgs (KnownWorkflow args result) = args
type WorkflowResult (KnownWorkflow args result) 
Instance details

Defined in Temporal.Workflow.Definition

type WorkflowResult (KnownWorkflow args result) = result

Methods

workflowRef :: KnownWorkflow args result -> KnownWorkflow (WorkflowArgs (KnownWorkflow args result)) (WorkflowResult (KnownWorkflow args result)) Source #

startChildWorkflow :: (RequireCallStack, WorkflowRef wf) => wf -> StartChildWorkflowOptions -> WorkflowArgs wf :->: Workflow (ChildWorkflowHandle (WorkflowResult wf)) Source #

Start a child Workflow execution

Returns a client-side handle that implements a child Workflow interface.

By default, a child will be scheduled on the same task queue as its parent.

A child Workflow handle supports awaiting completion, signaling and cancellation via the returned handle.

In order to query the child, use a WorkflowClient from an Activity.

data ChildWorkflowHandle result Source #

A client side handle to a single child Workflow instance.

It can be used to signal, wait for completion, and cancel the workflow.

Instances

Instances details
Functor ChildWorkflowHandle Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

WorkflowHandle ChildWorkflowHandle Source # 
Instance details

Defined in Temporal.Workflow

Cancel (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type CancelResult (ChildWorkflowHandle a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Wait (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type WaitResult (ChildWorkflowHandle a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type CancelResult (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type WaitResult (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

class Wait h where Source #

Some tasks in a Workflow return a handle that can be used to wait for the task to complete.

This class provides a common interface for waiting on these handles.

Associated Types

type WaitResult h Source #

Methods

wait :: h -> WaitResult h Source #

Wait for a handle on an an action to complete.

Instances

Instances details
Wait Timer Source # 
Instance details

Defined in Temporal.Workflow

Associated Types

type WaitResult Timer 
Instance details

Defined in Temporal.Workflow

Wait (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type WaitResult (ChildWorkflowHandle a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Wait (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type WaitResult (Task a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type WaitResult (Task a) = Workflow a

Methods

wait :: Task a -> WaitResult (Task a) Source #

class Cancel h where Source #

Some tasks in a Workflow return a handle that can be used to cancel a task.

This class provides a common interface for performing cancellation on these handles.

Associated Types

type CancelResult h Source #

Methods

cancel :: h -> CancelResult h Source #

Signal to Temporal that a handle representing an async action should be cancelled.

Instances

Instances details
Cancel Timer Source # 
Instance details

Defined in Temporal.Workflow

Associated Types

type CancelResult Timer 
Instance details

Defined in Temporal.Workflow

Cancel (ChildWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type CancelResult (ChildWorkflowHandle a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Cancel (ExternalWorkflowHandle a) Source #

Returns an action that can be used to await cancellation of an external workflow.

Throws CancelExternalWorkflowFailed if the cancellation request failed.

Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Cancel (Task a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

Associated Types

type CancelResult (Task a) 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type CancelResult (Task a) = Workflow ()

Methods

cancel :: Task a -> CancelResult (Task a) Source #

class WorkflowHandle (h :: k -> Type) where Source #

A client side handle to a single Workflow instance. It can be used to signal a workflow execution.

Given the following Workflow definition:

Methods

signal :: forall ref (result :: k). (SignalRef ref, RequireCallStack) => h result -> ref -> SignalArgs ref :->: Workflow (Task ()) Source #

Signal a running Workflow.

Instances

Instances details
WorkflowHandle ChildWorkflowHandle Source # 
Instance details

Defined in Temporal.Workflow

WorkflowHandle ExternalWorkflowHandle Source # 
Instance details

Defined in Temporal.Workflow

data ExternalWorkflowHandle result Source #

Handle representing an external Workflow Execution.

This handle can only be cancelled and signalled.

To call other methods, like query and result, use a WorkflowClient.getHandle inside an Activity.

Instances

Instances details
WorkflowHandle ExternalWorkflowHandle Source # 
Instance details

Defined in Temporal.Workflow

Cancel (ExternalWorkflowHandle a) Source #

Returns an action that can be used to await cancellation of an external workflow.

Throws CancelExternalWorkflowFailed if the cancellation request failed.

Instance details

Defined in Temporal.Workflow.Unsafe.Handle

type CancelResult (ExternalWorkflowHandle a) Source # 
Instance details

Defined in Temporal.Workflow.Unsafe.Handle

getExternalWorkflowHandle :: RequireCallStack => WorkflowId -> Maybe RunId -> Workflow (ExternalWorkflowHandle result) Source #

Returns a client-side handle that can be used to signal and cancel an existing Workflow execution. It takes a Workflow ID and optional run ID.

data RetryPolicy Source #

A Retry Policy is a collection of attributes that instructs the Temporal Server how to retry a failure of a Workflow Execution or an Activity Task Execution.

Constructors

RetryPolicy 

Fields

  • initialInterval :: Duration

    Amount of time that must elapse before the first retry occurs.

    The default value is 1 second.

    Use case: This is used as the base interval time for the Backoff Coefficient to multiply against.

  • backoffCoefficient :: Double

    The value dictates how much the retry interval increases.

    The default value is 2.0.

    A backoff coefficient of 1.0 means that the retry interval always equals the Initial Interval.

    Use case: Use this attribute to increase the interval between retries. By having a backoff coefficient greater than 1.0, the first few retries happen relatively quickly to overcome intermittent failures, but subsequent retries happen farther and farther apart to account for longer outages. Use the Maximum Interval attribute to prevent the coefficient from increasing the retry interval too much.

  • maximumInterval :: Maybe Duration

    Specifies the maximum interval between retries.

    The default value is 100x of the Initial Interval.

    Use case: This attribute is useful for Backoff Coefficients that are greater than 1.0 because it prevents the retry interval from growing infinitely.

  • maximumAttempts :: Int32

    Specifies the maximum number of execution attempts that can be made in the presence of failures.

    The default is unlimited.

    If this limit is exceeded, the execution fails without retrying again. When this happens an error is returned.

    • Setting the value to 0 also means unlimited.
    • Setting the value to 1 means a single execution attempt and no retries.
    • Setting the value to a negative integer results in an error when the execution is invoked.

    Use case: Use this attribute to ensure that retries do not continue indefinitely. However, in the majority of cases, we recommend relying on the Workflow Execution Timeout, in the case of Workflows, or Schedule-To-Close Timeout, in the case of Activities, to limit the total duration of retries instead of using this attribute.

  • nonRetryableErrorTypes :: Vector Text

    Description: Specifies errors that shouldn't be retried.

    The default is an empty vector. Errors are matched against the type field of the Application Failure. If one of those errors occurs, a retry does not occur.

Instances

Instances details
FromJSON RetryPolicy Source # 
Instance details

Defined in Temporal.Common

ToJSON RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Data RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RetryPolicy -> c RetryPolicy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RetryPolicy #

toConstr :: RetryPolicy -> Constr #

dataTypeOf :: RetryPolicy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RetryPolicy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RetryPolicy) #

gmapT :: (forall b. Data b => b -> b) -> RetryPolicy -> RetryPolicy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RetryPolicy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RetryPolicy -> r #

gmapQ :: (forall d. Data d => d -> u) -> RetryPolicy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RetryPolicy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RetryPolicy -> m RetryPolicy #

Generic RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Associated Types

type Rep RetryPolicy 
Instance details

Defined in Temporal.Common

type Rep RetryPolicy = D1 ('MetaData "RetryPolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "RetryPolicy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "initialInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Duration) :*: S1 ('MetaSel ('Just "backoffCoefficient") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "maximumInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Duration)) :*: (S1 ('MetaSel ('Just "maximumAttempts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int32) :*: S1 ('MetaSel ('Just "nonRetryableErrorTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector Text))))))
Show RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Eq RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Lift RetryPolicy Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => RetryPolicy -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => RetryPolicy -> Code m RetryPolicy #

type Rep RetryPolicy Source # 
Instance details

Defined in Temporal.Common

type Rep RetryPolicy = D1 ('MetaData "RetryPolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "RetryPolicy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "initialInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Duration) :*: S1 ('MetaSel ('Just "backoffCoefficient") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "maximumInterval") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Duration)) :*: (S1 ('MetaSel ('Just "maximumAttempts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int32) :*: S1 ('MetaSel ('Just "nonRetryableErrorTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector Text))))))

data ParentInfo Source #

Instances

Instances details
Generic ParentInfo Source # 
Instance details

Defined in Temporal.Common

Associated Types

type Rep ParentInfo 
Instance details

Defined in Temporal.Common

type Rep ParentInfo = D1 ('MetaData "ParentInfo" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "ParentInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "parentNamespace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: (S1 ('MetaSel ('Just "parentRunId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RunId) :*: S1 ('MetaSel ('Just "parentWorkflowId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkflowId))))
Show ParentInfo Source # 
Instance details

Defined in Temporal.Common

Eq ParentInfo Source # 
Instance details

Defined in Temporal.Common

type Rep ParentInfo Source # 
Instance details

Defined in Temporal.Common

type Rep ParentInfo = D1 ('MetaData "ParentInfo" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) (C1 ('MetaCons "ParentInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "parentNamespace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: (S1 ('MetaSel ('Just "parentRunId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RunId) :*: S1 ('MetaSel ('Just "parentWorkflowId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkflowId))))

Workflow metadata

info :: Workflow Info Source #

We recommend calling info whenever accessing Info fields. Some Info fields change during the lifetime of an Execution— like historyLength and searchAttributes— and some may be changeable in the future— like taskQueue.

getMemoValues :: Workflow (Map Text Payload) Source #

Current workflow's raw memo values.

lookupMemoValue :: Text -> Workflow (Maybe Payload) Source #

Lookup a memo value by key.

upsertSearchAttributes :: RequireCallStack => Map SearchAttributeKey SearchAttributeType -> Workflow () Source #

Updates this Workflow's Search Attributes by merging the provided searchAttributes with the existing Search Attributes

Using this function will overwrite any existing Search Attributes with the same key.

Versioning workflows

Versioning (known as "patching" in the Haskell library) lets you update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows.

You may need to patch if:

  • You want to change the remaining logic of a Workflow while it is still running
  • If your new logic can result in a different execution path

patched :: RequireCallStack => PatchId -> Workflow Bool Source #

Patch or upgrade workflow code by checking or stating that this workflow has a certain patch.

See official Temporal docs page for info.

If the workflow is replaying an existing history, then this function returns true if that history was produced by a worker which also had a patched call with the same patchId.

If the history was produced by a worker without such a call, then it will return false.

If the workflow is not currently replaying, then this call always returns true.

Your workflow code should run the "new" code if this returns true, if it returns false, you should run the "old" code. By doing this, you can maintain determinism.

deprecatePatch :: RequireCallStack => PatchId -> Workflow () Source #

Indicate that a patch is being phased out.

See official Temporal docs page for info.

Workflows with this call may be deployed alongside workflows with a patched call, but they must not be deployed while any workers still exist running old code without a patched call, or any runs with histories produced by such workers exist. If either kind of worker encounters a history produced by the other, their behavior is undefined.

Once all live workflow runs have been produced by workers with this call, you can deploy workers which are free of either kind of patch call for this ID. Workers with and without this call may coexist, as long as they are both running the "new" code.

Concurrency within Workflows

race :: RequireCallStack => Workflow a -> Workflow b -> Workflow (Either a b) Source #

This function takes two Workflow computations as input, and returns the output of whichever computation finished first. The evaluation of the remaining computation is discontinued.

Note: This function doesn't have a way to explicitly signal to the incomplete other computation that it will no longer be evaluated, so you should be careful about ensuring that incomplete computations are not problematic for your problem domain.

race_ :: RequireCallStack => Workflow a -> Workflow b -> Workflow () Source #

Run two Workflow actions concurrently, and return the first to finish.

Unlike 'Control.Concurrent.Async.race, this function doesn't explicitly cancel the other computation. If you want to cancel the other computation, you should return sufficient context to do so manually

concurrently :: Workflow a -> Workflow b -> Workflow (a, b) Source #

Run two Workflow actions concurrently, and return both results. If either action throws an exception at any time, the other action will run to completion as long as the exception is caught and handled.

concurrently_ :: Workflow a -> Workflow b -> Workflow () Source #

Like concurrently, but ignore the result values.

mapConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b) Source #

Map an effect-performing function over over any Traversable data type, performing each action concurrently, returning the original data structure with the arguments replaced with the results.

This is actually a bit of a misnomer, since it's really traverseConcurrently, but this is copied to mimic the async package's naming to slightly ease adoption.

replicateConcurrently :: Int -> Workflow a -> Workflow [a] Source #

Perform the action in the given number of evaluation branches.

replicateConcurrently_ :: Int -> Workflow a -> Workflow () Source #

Perform the action in the given number of evaluation branches, discarding the results

forConcurrently :: Traversable t => t a -> (a -> Workflow b) -> Workflow (t b) Source #

traverseConcurrently with the arguments flipped.

forConcurrently_ :: Foldable t => t a -> (a -> Workflow b) -> Workflow () Source #

traverseConcurrently_ with the arguments flipped.

traverseConcurrently :: Traversable t => (a -> Workflow b) -> t a -> Workflow (t b) Source #

Evaluate the action in the given number of evaluation branches, accumulating the results

traverseConcurrently_ :: Foldable t => (a -> Workflow b) -> t a -> Workflow () Source #

sequenceConcurrently :: Traversable t => t (Workflow a) -> Workflow (t a) Source #

Evaluate each Workflow action in the structure concurrently, and collect the results.

sequenceConcurrently_ :: Foldable t => t (Workflow a) -> Workflow () Source #

Evaluate each Workflow action in the structure concurrently, and ignore the results.

newtype ConcurrentWorkflow a Source #

A value of type ConcurrentWorkflow a is a Workflow operation that can be composed with other ConcurrentWorkflow values, using the Applicative and Alternative instances.

ConcurrentWorkflow effectively operates as a computation DAG. It's evaluated by exploring the expression across all of the branches of computation until every branch becomes blocked waiting on results from Temporal.

Once that happens, it submits all commands that it has accumulated to the Temporal orchestrator and waits to be reactivated with commands from the orchestrator that unblock computation on one or more branches. This is repeated until the computation completes. When Applicative is used, that means that each computation branch doesn't depend on the result of the others, so they can all explore as far as possible and get blocked. If we use Monad, then that means that the result of the previous computation has to become unblocked in order to provide the result to the subsequent computation.

Instances

Instances details
MonadCatch ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

MonadThrow ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

Alternative ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

Applicative ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

Functor ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

Monad ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

MonadLogger ConcurrentWorkflow Source # 
Instance details

Defined in Temporal.Workflow

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ConcurrentWorkflow () #

Monoid a => Monoid (ConcurrentWorkflow a) Source # 
Instance details

Defined in Temporal.Workflow

Semigroup a => Semigroup (ConcurrentWorkflow a) Source # 
Instance details

Defined in Temporal.Workflow

biselectOpt :: RequireCallStack => (l -> Either a b) -> (r -> Either a c) -> (a -> t) -> ((b, c) -> t) -> Workflow l -> Workflow r -> Workflow t Source #

The biselectOpt function combines two workflows and applies optimized selection logic.

This function is inspired by the Haxl library's Haxl.Core.Parallel functions. It takes two workflows and combines them, applying discrimination functions to their results to determine the final outcome. The function works as follows:

  1. It explores both workflows concurrently.
  2. If the left workflow completes first: - If the first argument returns Left, the result is immediately returned using the third function. - If the first argument returns Right, it waits for the right workflow to complete.
  3. If the right workflow completes first: - If the second argument returns Left, the result is immediately returned using the third function. - If the second argument returns Right, it waits for the left workflow to complete.
  4. If both workflows complete: - The results are combined using the fourth function if both discriminators return Right.
  5. If either workflow throws an exception, the exception is propagated.
  6. If either workflow is blocked, the function manages the blocking and resumption of computation.

This function optimizes the execution by short-circuiting when possible and managing concurrency efficiently. Be cautious when using this function, as exceptions and evaluation order can be unpredictable depending on the discriminator functions provided.

Interacting with running Workflows

Queries

A Query is a synchronous operation that is used to get the state of a Workflow Execution. The state of a running Workflow Execution is constantly changing. You can use Queries to expose the internal Workflow Execution state to the external world. Queries are available for running or completed Workflows Executions only if the Worker is up and listening on the Task Queue.

Queries are strongly consistent and are guaranteed to return the most recent state. This means that the data reflects the state of all confirmed Events that came in before the Query was sent. An Event is considered confirmed if the call creating the Event returned success. Events that are created while the Query is outstanding may or may not be reflected in the Workflow state the Query result is based on.

A Query can carry arguments to specify the data it is requesting. And each Workflow can expose data to multiple types of Queries.

A Query cannot mutate the state of the Workflow Execution— that is, Queries are read-only and cannot contain any blocking code. This means, for example, that Query handling logic cannot schedule Activity Executions.

class QueryRef query where Source #

Associated Types

type QueryArgs query :: [Type] Source #

type QueryResult query Source #

Methods

queryRef :: query -> KnownQuery (QueryArgs query) (QueryResult query) Source #

Instances

Instances details
QueryRef (KnownQuery args result) Source # 
Instance details

Defined in Temporal.Workflow.Query

Associated Types

type QueryArgs (KnownQuery args result) 
Instance details

Defined in Temporal.Workflow.Query

type QueryArgs (KnownQuery args result) = args
type QueryResult (KnownQuery args result) 
Instance details

Defined in Temporal.Workflow.Query

type QueryResult (KnownQuery args result) = result

Methods

queryRef :: KnownQuery args result -> KnownQuery (QueryArgs (KnownQuery args result)) (QueryResult (KnownQuery args result)) Source #

data Query a Source #

The Query monad is a very constrained version of the Workflow monad. It can only read state variables and return values. It is used to define query handlers.

Instances

Instances details
Applicative Query Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

pure :: a -> Query a #

(<*>) :: Query (a -> b) -> Query a -> Query b #

liftA2 :: (a -> b -> c) -> Query a -> Query b -> Query c #

(*>) :: Query a -> Query b -> Query b #

(<*) :: Query a -> Query b -> Query a #

Functor Query Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

fmap :: (a -> b) -> Query a -> Query b #

(<$) :: a -> Query b -> Query a #

Monad Query Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

(>>=) :: Query a -> (a -> Query b) -> Query b #

(>>) :: Query a -> Query b -> Query b #

return :: a -> Query a #

MonadReadStateVar Query Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

data KnownQuery (args :: [Type]) result Source #

Queries are sent from a Temporal Client to a Workflow Execution. The API call is synchronous. The Query is identified at both ends by a Query name. The Workflow must have a Query handler that is developed to handle that Query and provide data that represents the state of the Workflow Execution.

Queries are strongly consistent and are guaranteed to return the most recent state. This means that the data reflects the state of all confirmed Events that came in before the Query was sent. An Event is considered confirmed if the call creating the Event returned success. Events that are created while the Query is outstanding may or may not be reflected in the Workflow state the Query result is based on.

A Query can carry arguments to specify the data it is requesting. And each Workflow can expose data to multiple types of Queries.

A Query must never mutate the state of the Workflow Execution— that is, Queries are read-only and cannot contain any blocking code. This means, for example, that Query handling logic cannot schedule Activity Executions.

Sending Queries to completed Workflow Executions is supported, though Query reject conditions can be configured per Query

Constructors

(Codec codec result, ApplyPayloads codec args, GatherArgs codec args) => KnownQuery 

Fields

Instances

Instances details
QueryRef (KnownQuery args result) Source # 
Instance details

Defined in Temporal.Workflow.Query

Associated Types

type QueryArgs (KnownQuery args result) 
Instance details

Defined in Temporal.Workflow.Query

type QueryArgs (KnownQuery args result) = args
type QueryResult (KnownQuery args result) 
Instance details

Defined in Temporal.Workflow.Query

type QueryResult (KnownQuery args result) = result

Methods

queryRef :: KnownQuery args result -> KnownQuery (QueryArgs (KnownQuery args result)) (QueryResult (KnownQuery args result)) Source #

type QueryArgs (KnownQuery args result) Source # 
Instance details

Defined in Temporal.Workflow.Query

type QueryArgs (KnownQuery args result) = args
type QueryResult (KnownQuery args result) Source # 
Instance details

Defined in Temporal.Workflow.Query

type QueryResult (KnownQuery args result) = result

setQueryHandler :: (QueryRef query, f ~ (QueryArgs query :->: Query (QueryResult query)), RequireCallStack) => query -> f -> Workflow () Source #

Register a query handler.

The handler will be called when a query with the given name is received.

Signals

class SignalRef sig where Source #

Associated Types

type SignalArgs sig :: [Type] Source #

Methods

signalRef :: sig -> KnownSignal (SignalArgs sig) Source #

Instances

Instances details
SignalRef (KnownSignal args) Source # 
Instance details

Defined in Temporal.Workflow.Signal

Associated Types

type SignalArgs (KnownSignal args) 
Instance details

Defined in Temporal.Workflow.Signal

type SignalArgs (KnownSignal args) = args

data KnownSignal (args :: [Type]) Source #

Constructors

(ApplyPayloads codec args, GatherArgs codec args) => KnownSignal 

Fields

Instances

Instances details
SignalRef (KnownSignal args) Source # 
Instance details

Defined in Temporal.Workflow.Signal

Associated Types

type SignalArgs (KnownSignal args) 
Instance details

Defined in Temporal.Workflow.Signal

type SignalArgs (KnownSignal args) = args
type SignalArgs (KnownSignal args) Source # 
Instance details

Defined in Temporal.Workflow.Signal

type SignalArgs (KnownSignal args) = args

data Condition a Source #

A very restricted Monad that allows for reading StateVar values. This Monad keeps track of which StateVar values are read so that it can block and retry the computation if any of the values change.

Instances

Instances details
Applicative Condition Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

pure :: a -> Condition a #

(<*>) :: Condition (a -> b) -> Condition a -> Condition b #

liftA2 :: (a -> b -> c) -> Condition a -> Condition b -> Condition c #

(*>) :: Condition a -> Condition b -> Condition b #

(<*) :: Condition a -> Condition b -> Condition a #

Functor Condition Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

fmap :: (a -> b) -> Condition a -> Condition b #

(<$) :: a -> Condition b -> Condition a #

Monad Condition Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

(>>=) :: Condition a -> (a -> Condition b) -> Condition b #

(>>) :: Condition a -> Condition b -> Condition b #

return :: a -> Condition a #

MonadReadStateVar Condition Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

waitCondition :: RequireCallStack => Condition Bool -> Workflow () Source #

Wait on a condition to become true before continuing.

This must be used with signals, steps executed concurrently via the Applicative instance, or with the race command, as those are the only way for state to change in a workflow while a portion of the workflow itself is in this blocking condition.

N.B. this should be used with care, as it can lead to the workflow suspending indefinitely if the condition is never met. (e.g. if there is no signal handler that changes the state appropriately)

Other utilities

unsafeAsyncEffectSink :: RequireCallStack => IO () -> Workflow () Source #

While workflows are deterministic, there are categories of operational concerns (metrics, logging, tracing, etc.) that require access to IO operations like the network or filesystem. The IO monad is not generally available in the Workflow monad, but you can use sink to run an IO action in a workflow. In order to maintain determinism, the operation will be executed asynchronously and does not return a value. Be sure that the sink operation terminates, or else you will leak memory and/or threads.

Do not use sink for any Workflow logic, or else you will violate determinism.

State vars

data StateVar a Source #

StateVar values are mutable variables scoped to a Workflow run.

Workflows are deterministic, so you may not use normal IORefs, since the IORef could have been created outside of the workflow and cause nondeterminism.

However, it is totally safe to mutate state variables as long as they are scoped to a workflow and derive their state transitions from the workflow's deterministic execution.

StateVar values may also be read from within a query and mutated within signal handlers.

Instances

Instances details
Eq (StateVar a) Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

(==) :: StateVar a -> StateVar a -> Bool #

(/=) :: StateVar a -> StateVar a -> Bool #

Ord (StateVar a) Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

compare :: StateVar a -> StateVar a -> Ordering #

(<) :: StateVar a -> StateVar a -> Bool #

(<=) :: StateVar a -> StateVar a -> Bool #

(>) :: StateVar a -> StateVar a -> Bool #

(>=) :: StateVar a -> StateVar a -> Bool #

max :: StateVar a -> StateVar a -> StateVar a #

min :: StateVar a -> StateVar a -> StateVar a #

class MonadReadStateVar (m :: Type -> Type) where Source #

Methods

readStateVar :: StateVar a -> m a Source #

class MonadWriteStateVar (m :: Type -> Type) where Source #

Methods

writeStateVar :: StateVar a -> a -> m () Source #

modifyStateVar :: StateVar a -> (a -> a) -> m () Source #

Instances

Instances details
MonadWriteStateVar Workflow Source # 
Instance details

Defined in Temporal.Workflow.Internal.Monad

Methods

writeStateVar :: StateVar a -> a -> Workflow () Source #

modifyStateVar :: StateVar a -> (a -> a) -> Workflow () Source #

Time and timers

now :: Workflow UTCTime Source #

Current time from the workflow perspective.

The time returned is updated only when the workflow performs an operation in the Workflow monad that blocks. Examples of such operations are sleep, awaitCondition, awaitActivity, awaitWorkflow, etc.

Equivalent to getCurrentTime from the time package.

time :: RequireCallStack => Workflow SystemTime Source #

Current time from the workflow perspective.

The value is relative to epoch time.

data Timer Source #

Instances

Instances details
Cancel Timer Source # 
Instance details

Defined in Temporal.Workflow

Associated Types

type CancelResult Timer 
Instance details

Defined in Temporal.Workflow

Wait Timer Source # 
Instance details

Defined in Temporal.Workflow

Associated Types

type WaitResult Timer 
Instance details

Defined in Temporal.Workflow

type CancelResult Timer Source # 
Instance details

Defined in Temporal.Workflow

type WaitResult Timer Source # 
Instance details

Defined in Temporal.Workflow

createTimer :: Duration -> Workflow (Maybe Timer) Source #

Asynchronous sleep.

Creates a timer that fires after the specified duration.

The timer is not guaranteed to fire immediately after the duration expires, but it is intended to fire as close to the expiration as possible.

Note that the timer is started when the command is received by the Temporal Platform, not when the timer is created. The command is sent as soon as the workflow is blocked by any operation, such as sleep, awaitCondition, awaitActivity, awaitWorkflow, etc.

If the duration is less than or equal to zero, the timer will not be created.

scheduledTime :: Workflow (Maybe UTCTime) Source #

When using the Schedules feature of Temporal, this is the effective time that an instance was scheduled to run, according to the TemporalScheduledStartTime search attribute.

This is useful for backfilling or retrying a scheduled Workflow if you need the schedule to have a stable start time.

Workflow cancellation

isCancelRequested :: RequireCallStack => Workflow Bool Source #

Workflows may be sent a cancellation request from the Temporal Platform, but Workflow code is not required to respond to the cancellation request.

In order to opt in to cancellation handling, you can call isCancelRequested periodically within your workflow code to check whether a cancellation request has been received.

waitCancellation :: RequireCallStack => Workflow () Source #

Block the current workflow's main execution thread until the workflow is cancelled.

The workflow can still respond to signals and queries while waiting for cancellation.

Upon cancellation, the workflow will throw a WorkflowCancelRequested exception.

This function is useful for actor-style workflows that perform work in response to signals and/or respond to queries, but otherwise need to remain idle on their main codepath.

N.B. It is likely not safe to call this in a signal handler.

Random value generation

Workflow executions are deterministic, so you can't use the usual IO-based random number generation.

Instead, each workflow execution is given a seed from the Temporal platform to seed a PRNG. This allows you to generate random values in a deterministic way.

The Workflow monad provides a RandomGen instance, so you can use the usual random and randomR functions from the Random and Stateful modules.

randomGen :: Workflow WorkflowGenM Source #

Get a mutable randomness generator for the workflow.

uuid4 :: Workflow UUID Source #

Generate an RFC compliant V4 uuid.

Uses the workflow's deterministic PRNG, making it safe for use within a workflow.

This function is cryptographically insecure.

uuid7 :: RequireCallStack => Workflow UUID Source #

Generates a UUIDv7 using the current time (from time) and random data (from workflowRandomnessSeed).

Continue as new

continueAsNew Source #

Arguments

:: WorkflowRef wf 
=> wf

The workflow to continue as new. It doesn't have to be the same as the current workflow.

-> ContinueAsNewOptions 
-> WorkflowArgs wf :->: Workflow (WorkflowResult wf) 

Continue-As-New is a mechanism by which the latest relevant state is passed to a new Workflow Execution, with a fresh Event History.

As a precautionary measure, the Temporal Platform limits the total Event History to 51,200 Events or 50 MB, and will warn you after 10,240 Events or 10 MB. To prevent a Workflow Execution Event History from exceeding this limit and failing, use Continue-As-New to start a new Workflow Execution with a fresh Event History.

All values passed to a Workflow Execution through parameters or returned through a result value are recorded into the Event History. A Temporal Cluster stores the full Event History of a Workflow Execution for the duration of a Namespace's retention period. A Workflow Execution that periodically executes many Activities has the potential of hitting the size limit.

A very large Event History can adversely affect the performance of a Workflow Execution. For example, in the case of a Workflow Worker failure, the full Event History must be pulled from the Temporal Cluster and given to another Worker via a Workflow Task. If the Event history is very large, it may take some time to load it.

The Continue-As-New feature enables developers to complete the current Workflow Execution and start a new one atomically.

The new Workflow Execution has the same Workflow Id, but a different Run Id, and has its own Event History. TODO, don't make this an exception, make it a return value

Type definitions

type GatherArgs codec (args :: [Type]) = (VarArgs args, AllArgs (Codec codec) args) Source #

newtype ActivityId Source #

A unique identifier for an Activity Execution.

Constructors

ActivityId 

Fields

Instances

Instances details
FromJSON ActivityId Source # 
Instance details

Defined in Temporal.Common

ToJSON ActivityId Source # 
Instance details

Defined in Temporal.Common

IsString ActivityId Source # 
Instance details

Defined in Temporal.Common

Show ActivityId Source # 
Instance details

Defined in Temporal.Common

Eq ActivityId Source # 
Instance details

Defined in Temporal.Common

Ord ActivityId Source # 
Instance details

Defined in Temporal.Common

Hashable ActivityId Source # 
Instance details

Defined in Temporal.Common

Lift ActivityId Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => ActivityId -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => ActivityId -> Code m ActivityId #

newtype WorkflowId Source #

A Workflow Id is a customizable, application-level identifier for a Workflow Execution that is unique to an Open Workflow Execution within a Namespace.

Constructors

WorkflowId 

Fields

Instances

Instances details
FromJSON WorkflowId Source # 
Instance details

Defined in Temporal.Common

ToJSON WorkflowId Source # 
Instance details

Defined in Temporal.Common

IsString WorkflowId Source # 
Instance details

Defined in Temporal.Common

Show WorkflowId Source # 
Instance details

Defined in Temporal.Common

Eq WorkflowId Source # 
Instance details

Defined in Temporal.Common

Ord WorkflowId Source # 
Instance details

Defined in Temporal.Common

Hashable WorkflowId Source # 
Instance details

Defined in Temporal.Common

Lift WorkflowId Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => WorkflowId -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => WorkflowId -> Code m WorkflowId #

newtype Namespace Source #

A Namespace is a unit of isolation within the Temporal Platform

Constructors

Namespace 

Fields

Instances

Instances details
FromJSON Namespace Source # 
Instance details

Defined in Temporal.Common

ToJSON Namespace Source # 
Instance details

Defined in Temporal.Common

IsString Namespace Source # 
Instance details

Defined in Temporal.Common

Show Namespace Source # 
Instance details

Defined in Temporal.Common

Eq Namespace Source # 
Instance details

Defined in Temporal.Common

Ord Namespace Source # 
Instance details

Defined in Temporal.Common

Hashable Namespace Source # 
Instance details

Defined in Temporal.Common

Lift Namespace Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => Namespace -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Namespace -> Code m Namespace #

newtype TaskQueue Source #

A Task Queue is a queue that a Worker Process polls for Tasks.

Task Queues do not have any ordering guarantees. It is possible to have a Task that stays in a Task Queue for a period of time, if there is a backlog that wasn't drained for that time.

Task Queues are very lightweight components. Task Queues do not require explicit registration but instead are created on demand when a Workflow Execution or Activity spawns or when a Worker Process subscribes to it. When a Task Queue is created, both a Workflow Task Queue and an Activity Task Queue are created under the same name. There is no limit to the number of Task Queues a Temporal Application can use or a Temporal Cluster can maintain.

Constructors

TaskQueue 

Fields

Instances

Instances details
FromJSON TaskQueue Source # 
Instance details

Defined in Temporal.Common

ToJSON TaskQueue Source # 
Instance details

Defined in Temporal.Common

Data TaskQueue Source # 
Instance details

Defined in Temporal.Common

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TaskQueue -> c TaskQueue #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TaskQueue #

toConstr :: TaskQueue -> Constr #

dataTypeOf :: TaskQueue -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TaskQueue) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TaskQueue) #

gmapT :: (forall b. Data b => b -> b) -> TaskQueue -> TaskQueue #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TaskQueue -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TaskQueue -> r #

gmapQ :: (forall d. Data d => d -> u) -> TaskQueue -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TaskQueue -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TaskQueue -> m TaskQueue #

IsString TaskQueue Source # 
Instance details

Defined in Temporal.Common

Show TaskQueue Source # 
Instance details

Defined in Temporal.Common

Eq TaskQueue Source # 
Instance details

Defined in Temporal.Common

Ord TaskQueue Source # 
Instance details

Defined in Temporal.Common

Hashable TaskQueue Source # 
Instance details

Defined in Temporal.Common

Lift TaskQueue Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => TaskQueue -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => TaskQueue -> Code m TaskQueue #

newtype PatchId Source #

Constructors

PatchId 

Fields

Instances

Instances details
FromJSON PatchId Source # 
Instance details

Defined in Temporal.Common

ToJSON PatchId Source # 
Instance details

Defined in Temporal.Common

IsString PatchId Source # 
Instance details

Defined in Temporal.Common

Methods

fromString :: String -> PatchId #

Show PatchId Source # 
Instance details

Defined in Temporal.Common

Eq PatchId Source # 
Instance details

Defined in Temporal.Common

Methods

(==) :: PatchId -> PatchId -> Bool #

(/=) :: PatchId -> PatchId -> Bool #

Ord PatchId Source # 
Instance details

Defined in Temporal.Common

Hashable PatchId Source # 
Instance details

Defined in Temporal.Common

Methods

hashWithSalt :: Int -> PatchId -> Int #

hash :: PatchId -> Int #

Lift PatchId Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => PatchId -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => PatchId -> Code m PatchId #

newtype RunId Source #

A Run Id is a globally unique, platform-level identifier for a Workflow Execution.

The current Run Id is mutable and can change during a Workflow Retry. You shouldn't rely on storing the current Run Id, or using it for any logical choices, because a Workflow Retry changes the Run Id and can lead to non-determinism issues.

Temporal guarantees that only one Workflow Execution with a given Workflow Id can be in an Open state at any given time. But when a Workflow Execution reaches a Closed state, it is possible to have another Workflow Execution in an Open state with the same Workflow Id. For example, a Temporal Cron Job is a chain of Workflow Executions that all have the same Workflow Id. Each Workflow Execution within the chain is considered a Run.

A Run Id uniquely identifies a Workflow Execution even if it shares a Workflow Id with other Workflow Executions.

Constructors

RunId 

Fields

Instances

Instances details
FromJSON RunId Source # 
Instance details

Defined in Temporal.Common

ToJSON RunId Source # 
Instance details

Defined in Temporal.Common

IsString RunId Source # 
Instance details

Defined in Temporal.Common

Methods

fromString :: String -> RunId #

Show RunId Source # 
Instance details

Defined in Temporal.Common

Methods

showsPrec :: Int -> RunId -> ShowS #

show :: RunId -> String #

showList :: [RunId] -> ShowS #

Eq RunId Source # 
Instance details

Defined in Temporal.Common

Methods

(==) :: RunId -> RunId -> Bool #

(/=) :: RunId -> RunId -> Bool #

Ord RunId Source # 
Instance details

Defined in Temporal.Common

Methods

compare :: RunId -> RunId -> Ordering #

(<) :: RunId -> RunId -> Bool #

(<=) :: RunId -> RunId -> Bool #

(>) :: RunId -> RunId -> Bool #

(>=) :: RunId -> RunId -> Bool #

max :: RunId -> RunId -> RunId #

min :: RunId -> RunId -> RunId #

Hashable RunId Source # 
Instance details

Defined in Temporal.Common

Methods

hashWithSalt :: Int -> RunId -> Int #

hash :: RunId -> Int #

Lift RunId Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => RunId -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => RunId -> Code m RunId #

data ParentClosePolicy Source #

Used by the service to determine the fate of a child workflow in case its parent is closed.

Constructors

ParentClosePolicyUnspecified

Lets the server set the default.

ParentClosePolicyTerminate

Terminate the child workflow.

ParentClosePolicyAbandon

Do not terminate the child workflow. The child workflow continues to run.

ParentClosePolicyRequestCancel

Request cancellation on the child workflow.

Instances

Instances details
Data ParentClosePolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ParentClosePolicy -> c ParentClosePolicy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ParentClosePolicy #

toConstr :: ParentClosePolicy -> Constr #

dataTypeOf :: ParentClosePolicy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ParentClosePolicy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParentClosePolicy) #

gmapT :: (forall b. Data b => b -> b) -> ParentClosePolicy -> ParentClosePolicy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ParentClosePolicy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ParentClosePolicy -> r #

gmapQ :: (forall d. Data d => d -> u) -> ParentClosePolicy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ParentClosePolicy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ParentClosePolicy -> m ParentClosePolicy #

Show ParentClosePolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Eq ParentClosePolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Ord ParentClosePolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift ParentClosePolicy Source # 
Instance details

Defined in Temporal.Workflow.Types

Methods

lift :: Quote m => ParentClosePolicy -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => ParentClosePolicy -> Code m ParentClosePolicy #

data ChildWorkflowCancellationType Source #

Controls at which point to report back when a child workflow is cancelled.

Constructors

ChildWorkflowCancellationAbandon

Do not request cancellation of the child workflow if already scheduled

ChildWorkflowCancellationTryCancel

Initiate a cancellation request and immediately report cancellation to the parent workflow

ChildWorkflowCancellationWaitCancellationCompleted

Wait for child cancellation completion.

ChildWorkflowCancellationWaitCancellationRequested

Request cancellation of the child and wait for confirmation that the request was received.

Instances

Instances details
Data ChildWorkflowCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ChildWorkflowCancellationType -> c ChildWorkflowCancellationType #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ChildWorkflowCancellationType #

toConstr :: ChildWorkflowCancellationType -> Constr #

dataTypeOf :: ChildWorkflowCancellationType -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ChildWorkflowCancellationType) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ChildWorkflowCancellationType) #

gmapT :: (forall b. Data b => b -> b) -> ChildWorkflowCancellationType -> ChildWorkflowCancellationType #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ChildWorkflowCancellationType -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ChildWorkflowCancellationType -> r #

gmapQ :: (forall d. Data d => d -> u) -> ChildWorkflowCancellationType -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ChildWorkflowCancellationType -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ChildWorkflowCancellationType -> m ChildWorkflowCancellationType #

Show ChildWorkflowCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Eq ChildWorkflowCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Ord ChildWorkflowCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

Lift ChildWorkflowCancellationType Source # 
Instance details

Defined in Temporal.Workflow.Types

data WorkflowIdReusePolicy Source #

A Workflow Id Reuse Policy determines whether a Workflow Execution is allowed to spawn with a particular Workflow Id, if that Workflow Id has been used with a previous, and now Closed, Workflow Execution.

It is not possible for a new Workflow Execution to spawn with the same Workflow Id as another Open Workflow Execution, regardless of the Workflow Id Reuse Policy. In some cases, an attempt to spawn a Workflow Execution with a Workflow Id that is the same as the Id of a currently Open Workflow Execution results in a Workflow execution already started error.

Constructors

WorkflowIdReusePolicyUnspecified 
WorkflowIdReusePolicyAllowDuplicate

The Workflow Execution is allowed to exist regardless of the Closed status of a previous Workflow Execution with the same Workflow Id. This is currently the default policy, if one is not specified. Use this when it is OK to have a Workflow Execution with the same Workflow Id as a previous, but now Closed, Workflow Execution.

WorkflowIdReusePolicyAllowDuplicateFailedOnly

The Workflow Execution is allowed to exist only if a previous Workflow Execution with the same Workflow Id does not have a Completed status. Use this policy when there is a need to re-execute a Failed, Timed Out, Terminated or Cancelled Workflow Execution and guarantee that the Completed Workflow Execution will not be re-executed.

WorkflowIdReusePolicyRejectDuplicate

The Workflow Execution cannot exist if a previous Workflow Execution has the same Workflow Id, regardless of the Closed status. Use this when there can only be one Workflow Execution per Workflow Id within a Namespace for the given retention period.

WorkflowIdReusePolicyTerminateIfRunning

Specifies that if a Workflow Execution with the same Workflow Id is already running, it should be terminated and a new Workflow Execution with the same Workflow Id should be started. This policy allows for only one Workflow Execution with a specific Workflow Id to be running at any given time.

Instances

Instances details
FromJSON WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

ToJSON WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Data WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WorkflowIdReusePolicy -> c WorkflowIdReusePolicy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WorkflowIdReusePolicy #

toConstr :: WorkflowIdReusePolicy -> Constr #

dataTypeOf :: WorkflowIdReusePolicy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WorkflowIdReusePolicy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WorkflowIdReusePolicy) #

gmapT :: (forall b. Data b => b -> b) -> WorkflowIdReusePolicy -> WorkflowIdReusePolicy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WorkflowIdReusePolicy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WorkflowIdReusePolicy -> r #

gmapQ :: (forall d. Data d => d -> u) -> WorkflowIdReusePolicy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WorkflowIdReusePolicy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WorkflowIdReusePolicy -> m WorkflowIdReusePolicy #

Bounded WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Enum WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Generic WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Associated Types

type Rep WorkflowIdReusePolicy 
Instance details

Defined in Temporal.Common

type Rep WorkflowIdReusePolicy = D1 ('MetaData "WorkflowIdReusePolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) ((C1 ('MetaCons "WorkflowIdReusePolicyUnspecified" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicateFailedOnly" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WorkflowIdReusePolicyRejectDuplicate" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyTerminateIfRunning" 'PrefixI 'False) (U1 :: Type -> Type))))
Read WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Show WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Eq WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Ord WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

Lift WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

type Rep WorkflowIdReusePolicy Source # 
Instance details

Defined in Temporal.Common

type Rep WorkflowIdReusePolicy = D1 ('MetaData "WorkflowIdReusePolicy" "Temporal.Common" "temporal-sdk-0.0.1.0-inplace" 'False) ((C1 ('MetaCons "WorkflowIdReusePolicyUnspecified" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WorkflowIdReusePolicyAllowDuplicateFailedOnly" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WorkflowIdReusePolicyRejectDuplicate" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WorkflowIdReusePolicyTerminateIfRunning" 'PrefixI 'False) (U1 :: Type -> Type))))

newtype WorkflowType Source #

This is generally the name of the function itself

Constructors

WorkflowType 

Instances

Instances details
FromJSON WorkflowType Source # 
Instance details

Defined in Temporal.Common

ToJSON WorkflowType Source # 
Instance details

Defined in Temporal.Common

IsString WorkflowType Source # 
Instance details

Defined in Temporal.Common

Show WorkflowType Source # 
Instance details

Defined in Temporal.Common

Eq WorkflowType Source # 
Instance details

Defined in Temporal.Common

Ord WorkflowType Source # 
Instance details

Defined in Temporal.Common

Hashable WorkflowType Source # 
Instance details

Defined in Temporal.Common

Lift WorkflowType Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => WorkflowType -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => WorkflowType -> Code m WorkflowType #

type RequireCallStack = (HasCallStack, RequireCallStackImpl) #

This constraint is similar to HasCallStack in that it's presence will capture a stack frame for the call site of the function. Unlike HasCallStack, this is not a "magic" constraint that is automagically solved by GHC, which means that calling a function with this constraint will cause GHC to ask you to add this constraint to your own function.

For example, let's say you have a function unsafeHead :: RequireCallStack => [a] -> a. Then you go to call that function:

myCoolFunction :: [Int] -> Int
myCoolFunction = unsafeHead

GHC will complain about the lack of the RequireCallStack constraint. You will have two options:

  1. Add the constraint to your functions. This is a good option because it means the callstack from unsafeHead will include the myCoolFunction callsite as well.
   myCoolFunction :: RequireCallStack => [Int] -> Int
   myCoolFunction = unsafeHead
   
  1. Use provideCallStack to silence the error. This will truncate the callstack unless you use HasCallStack above. You should only do this if you're confident that you don't need any debugging information from a more complete callstack.
   myCoolFunction :: [Int] -> Int
   myCoolFunction = provideCallStack unsafeHead
   

Since: require-callstack-0.1.0.0

data TimeoutOptions Source #

Constructors

TimeoutOptions 

Fields

  • executionTimeout :: Maybe Duration

    A Workflow Execution Timeout is the maximum time that a Workflow Execution can be executing (have an Open status) including retries and any usage of Continue As New.

    The default value is ∞ (infinite). If this timeout is reached, the Workflow Execution changes to a Timed Out status. This timeout is different from the Workflow Run Timeout. This timeout is most commonly used for stopping the execution of a Temporal Cron Job after a certain amount of time has passed.

  • runTimeout :: Maybe Duration

    A Workflow Run Timeout is the maximum amount of time that a single Workflow Run is restricted to.

    The default is set to the same value as the Workflow Execution Timeout. This timeout is most commonly used to limit the execution time of a single Temporal Cron Job Execution.

    If the Workflow Run Timeout is reached, the Workflow Execution is Terminated.

  • taskTimeout :: Maybe Duration

    A Workflow Task Timeout is the maximum amount of time allowed for a Worker to execute a Workflow Task after the Worker has pulled that Workflow Task from the Task Queue.

    The default value is 10 seconds. This timeout is primarily available to recognize whether a Worker has gone down so that the Workflow Execution can be recovered on a different Worker. The main reason for increasing the default value would be to accommodate a Workflow Execution that has a very long Workflow Execution History that could take longer than 10 seconds for the Worker to load.

Instances

Instances details
Data TimeoutOptions Source # 
Instance details

Defined in Temporal.Common

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeoutOptions -> c TimeoutOptions #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeoutOptions #

toConstr :: TimeoutOptions -> Constr #

dataTypeOf :: TimeoutOptions -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeoutOptions) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeoutOptions) #

gmapT :: (forall b. Data b => b -> b) -> TimeoutOptions -> TimeoutOptions #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeoutOptions -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeoutOptions -> r #

gmapQ :: (forall d. Data d => d -> u) -> TimeoutOptions -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeoutOptions -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeoutOptions -> m TimeoutOptions #

Show TimeoutOptions Source # 
Instance details

Defined in Temporal.Common

Eq TimeoutOptions Source # 
Instance details

Defined in Temporal.Common

Lift TimeoutOptions Source # 
Instance details

Defined in Temporal.Common

Methods

lift :: Quote m => TimeoutOptions -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => TimeoutOptions -> Code m TimeoutOptions #

Commonly used

type family (args :: [Type]) :->: result where ... infixr 0 Source #

Construct a function type from a list of argument types and a result type.

Equations

('[] :: [Type]) :->: result = result 
(arg ': args) :->: result = arg -> args :->: result