module Reflex.GI.Gtk.Run.Class
( MonadRunGtk( runGtk_
, runGtk
, runGtkPromise
)
) where
import Control.Monad (join)
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Reader (ReaderT)
import Control.Monad.Trans (lift)
import Reflex ( PostBuildT
, TriggerEventT
)
class (MonadIO m) => MonadRunGtk m where
runGtk :: IO a -> m a
runGtk = m (m a) -> m a
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (m (m a) -> m a) -> (IO a -> m (m a)) -> IO a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m (m a)
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m (m a)
runGtkPromise
runGtk_ :: IO a -> m ()
runGtkPromise :: IO a -> m (m a)
instance MonadRunGtk m => MonadRunGtk (PostBuildT t m) where
runGtk :: IO a -> PostBuildT t m a
runGtk = m a -> PostBuildT t m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> PostBuildT t m a)
-> (IO a -> m a) -> IO a -> PostBuildT t m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m a
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m a
runGtk
runGtk_ :: IO a -> PostBuildT t m ()
runGtk_ = m () -> PostBuildT t m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> PostBuildT t m ())
-> (IO a -> m ()) -> IO a -> PostBuildT t m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m ()
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m ()
runGtk_
runGtkPromise :: IO a -> PostBuildT t m (PostBuildT t m a)
runGtkPromise = (m a -> PostBuildT t m a)
-> PostBuildT t m (m a) -> PostBuildT t m (PostBuildT t m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap m a -> PostBuildT t m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (PostBuildT t m (m a) -> PostBuildT t m (PostBuildT t m a))
-> (IO a -> PostBuildT t m (m a))
-> IO a
-> PostBuildT t m (PostBuildT t m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (m a) -> PostBuildT t m (m a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (m a) -> PostBuildT t m (m a))
-> (IO a -> m (m a)) -> IO a -> PostBuildT t m (m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m (m a)
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m (m a)
runGtkPromise
instance MonadRunGtk m => MonadRunGtk (TriggerEventT t m) where
runGtk :: IO a -> TriggerEventT t m a
runGtk = m a -> TriggerEventT t m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> TriggerEventT t m a)
-> (IO a -> m a) -> IO a -> TriggerEventT t m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m a
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m a
runGtk
runGtk_ :: IO a -> TriggerEventT t m ()
runGtk_ = m () -> TriggerEventT t m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> TriggerEventT t m ())
-> (IO a -> m ()) -> IO a -> TriggerEventT t m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m ()
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m ()
runGtk_
runGtkPromise :: IO a -> TriggerEventT t m (TriggerEventT t m a)
runGtkPromise = (m a -> TriggerEventT t m a)
-> TriggerEventT t m (m a)
-> TriggerEventT t m (TriggerEventT t m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap m a -> TriggerEventT t m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (TriggerEventT t m (m a)
-> TriggerEventT t m (TriggerEventT t m a))
-> (IO a -> TriggerEventT t m (m a))
-> IO a
-> TriggerEventT t m (TriggerEventT t m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (m a) -> TriggerEventT t m (m a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (m a) -> TriggerEventT t m (m a))
-> (IO a -> m (m a)) -> IO a -> TriggerEventT t m (m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m (m a)
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m (m a)
runGtkPromise
instance MonadRunGtk m => MonadRunGtk (ReaderT r m) where
runGtk :: IO a -> ReaderT r m a
runGtk = m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ReaderT r m a) -> (IO a -> m a) -> IO a -> ReaderT r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m a
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m a
runGtk
runGtk_ :: IO a -> ReaderT r m ()
runGtk_ = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ())
-> (IO a -> m ()) -> IO a -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m ()
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m ()
runGtk_
runGtkPromise :: IO a -> ReaderT r m (ReaderT r m a)
runGtkPromise = (m a -> ReaderT r m a)
-> ReaderT r m (m a) -> ReaderT r m (ReaderT r m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ReaderT r m (m a) -> ReaderT r m (ReaderT r m a))
-> (IO a -> ReaderT r m (m a))
-> IO a
-> ReaderT r m (ReaderT r m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (m a) -> ReaderT r m (m a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (m a) -> ReaderT r m (m a))
-> (IO a -> m (m a)) -> IO a -> ReaderT r m (m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> m (m a)
forall (m :: * -> *) a. MonadRunGtk m => IO a -> m (m a)
runGtkPromise