helic-0.6.1.0: Clipboard Manager
Safe HaskellSafe-Inferred
LanguageGHC2021

Helic.Effect.GtkMain

Description

An effect for concurrently controlling the lifecycle of a GTK main loop and accessing its resource.

Synopsis

Documentation

data GtkMain (s :: Type) :: Effect where Source #

This effect is a communication bridge between Gtk and GTK functionality effects like GtkClipboard. It does not directly interact with the GTK API, but allows a scope to ensure that the GTK main loop is running and to access its resource (usually a display handle).

Constructors

Access :: m s -> GtkMain s m s

If a resource is currently available, return it. Otherwise, execute the supplied action. Should be used to bracket Request.

Request :: m s -> GtkMain s m s

Trigger the execution of the GTK main loop, then wait for its resource to be available. If it does not, execute the supplied action.

Run :: m a -> GtkMain s m a

Bracket an action that runs the GTK main loop by clearing the resource, running the supplied action, then clearing the resource again and waiting for the next request.

Running :: s -> GtkMain s m ()

Store the main loop resource in the state to mark the loop as running.

running :: forall s r. Member (GtkMain s) r => s -> Sem r () Source #

Store the main loop resource in the state to mark the loop as running.

run :: forall s r a. Member (GtkMain s) r => Sem r a -> Sem r a Source #

Bracket an action that runs the GTK main loop by clearing the resource, running the supplied action, then clearing the resource again and waiting for the next request.

request :: forall s r. Member (GtkMain s) r => Sem r s -> Sem r s Source #

Trigger the execution of the GTK main loop, then wait for its resource to be available. If it does not, execute the supplied action.

access :: forall s r. Member (GtkMain s) r => Sem r s -> Sem r s Source #

If a resource is currently available, return it. Otherwise, execute the supplied action. Should be used to bracket Request.