matterhorn-50200.17.0: Terminal client for the Mattermost chat system
Safe HaskellNone
LanguageHaskell2010

Matterhorn.State.Async

Synopsis

Documentation

data AsyncPriority Source #

Priority setting for asynchronous work items. Preempt means that the queued item will be the next work item begun (i.e. it goes to the front of the queue); normal means it will go last in the queue.

Constructors

Preempt 
Normal 

doAsync :: AsyncPriority -> IO () -> MH () Source #

Run a computation in the background, ignoring any results from it.

doAsyncWith :: AsyncPriority -> IO (Maybe (MH ())) -> MH () Source #

Run a computation in the background, returning a computation to be called on the ChatState value.

doAsyncChannelMM :: DoAsyncChannelMM a Source #

Performs an asynchronous IO operation on a specific channel. On completion, the final argument a completion function is executed in an MH () context in the main (brick) thread.

doAsyncWithIO :: AsyncPriority -> ChatState -> IO (Maybe (MH ())) -> IO () Source #

Run a computation in the background, returning a computation to be called on the ChatState value.

doAsyncMM Source #

Arguments

:: AsyncPriority

the priority for this async operation

-> (Session -> IO a)

the async MM channel-based IO operation

-> (a -> Maybe (MH ()))

function to process the results in brick event handling context

-> MH () 

Performs an asynchronous IO operation. On completion, the final argument a completion function is executed in an MH () context in the main (brick) thread.

tryMM Source #

Arguments

:: IO a

The action to try (usually a MM API call)

-> (a -> IO (Maybe (MH ())))

What to do on success

-> IO (Maybe (MH ())) 

Try to run a computation, posting an informative error message if it fails with a MattermostServerError.

endAsyncNOP :: ChannelId -> a -> Maybe (MH ()) Source #

Use this convenience function if no operation needs to be performed in the MH state after an async operation completes.