{-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} #ifdef USE_REFLEX_OPTIMIZER {-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-} #endif module Reflex.NotReady.Class ( NotReady(..) ) where import Control.Monad.Reader (ReaderT) import Control.Monad.Trans import Control.Monad.Trans.Writer (WriterT) import Reflex.BehaviorWriter.Base (BehaviorWriterT) import Reflex.Class import Reflex.DynamicWriter.Base (DynamicWriterT) import Reflex.EventWriter.Base (EventWriterT) import Reflex.Host.Class import Reflex.PerformEvent.Base (PerformEventT (..)) import Reflex.PostBuild.Base (PostBuildT) import Reflex.Query.Base (QueryT) import Reflex.Requester.Base (RequesterT) import Reflex.TriggerEvent.Base (TriggerEventT) class Monad m => NotReady t m | m -> t where notReadyUntil :: Event t a -> m () default notReadyUntil :: (MonadTrans f, m ~ f m', NotReady t m') => Event t a -> m () notReadyUntil = m' () -> m () m' () -> f m' () forall (m :: * -> *) a. Monad m => m a -> f m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m' () -> m ()) -> (Event t a -> m' ()) -> Event t a -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m' () forall a. Event t a -> m' () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: m () default notReady :: (MonadTrans f, m ~ f m', NotReady t m') => m () notReady = m' () -> f m' () forall (m :: * -> *) a. Monad m => m a -> f m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m' () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (ReaderT r m) where notReadyUntil :: forall a. Event t a -> ReaderT r m () notReadyUntil = m () -> ReaderT r m () forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> ReaderT r m ()) -> (Event t a -> m ()) -> Event t a -> ReaderT r m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: ReaderT r m () notReady = m () -> ReaderT r m () forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance (NotReady t m, Monoid w) => NotReady t (WriterT w m) where notReadyUntil :: forall a. Event t a -> WriterT w m () notReadyUntil = m () -> WriterT w m () forall (m :: * -> *) a. Monad m => m a -> WriterT w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> WriterT w m ()) -> (Event t a -> m ()) -> Event t a -> WriterT w m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: WriterT w m () notReady = m () -> WriterT w m () forall (m :: * -> *) a. Monad m => m a -> WriterT w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (PostBuildT t m) where notReadyUntil :: forall a. Event t a -> PostBuildT t m () notReadyUntil = m () -> PostBuildT t m () forall (m :: * -> *) a. Monad m => m a -> PostBuildT t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> PostBuildT t m ()) -> (Event t a -> m ()) -> Event t a -> PostBuildT t m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: PostBuildT t m () notReady = m () -> PostBuildT t m () forall (m :: * -> *) a. Monad m => m a -> PostBuildT t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (EventWriterT t w m) where notReadyUntil :: forall a. Event t a -> EventWriterT t w m () notReadyUntil = m () -> EventWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> EventWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> EventWriterT t w m ()) -> (Event t a -> m ()) -> Event t a -> EventWriterT t w m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: EventWriterT t w m () notReady = m () -> EventWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> EventWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (DynamicWriterT t w m) where notReadyUntil :: forall a. Event t a -> DynamicWriterT t w m () notReadyUntil = m () -> DynamicWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> DynamicWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> DynamicWriterT t w m ()) -> (Event t a -> m ()) -> Event t a -> DynamicWriterT t w m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: DynamicWriterT t w m () notReady = m () -> DynamicWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> DynamicWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (BehaviorWriterT t w m) where notReadyUntil :: forall a. Event t a -> BehaviorWriterT t w m () notReadyUntil = m () -> BehaviorWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> BehaviorWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> BehaviorWriterT t w m ()) -> (Event t a -> m ()) -> Event t a -> BehaviorWriterT t w m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: BehaviorWriterT t w m () notReady = m () -> BehaviorWriterT t w m () forall (m :: * -> *) a. Monad m => m a -> BehaviorWriterT t w m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (QueryT t q m) where notReadyUntil :: forall a. Event t a -> QueryT t q m () notReadyUntil = m () -> QueryT t q m () forall (m :: * -> *) a. Monad m => m a -> QueryT t q m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> QueryT t q m ()) -> (Event t a -> m ()) -> Event t a -> QueryT t q m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: QueryT t q m () notReady = m () -> QueryT t q m () forall (m :: * -> *) a. Monad m => m a -> QueryT t q m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance (ReflexHost t, NotReady t (HostFrame t)) => NotReady t (PerformEventT t m) where notReadyUntil :: forall a. Event t a -> PerformEventT t m () notReadyUntil = RequesterT t (HostFrame t) Identity (HostFrame t) () -> PerformEventT t m () forall {k} t (m :: k) a. RequesterT t (HostFrame t) Identity (HostFrame t) a -> PerformEventT t m a PerformEventT (RequesterT t (HostFrame t) Identity (HostFrame t) () -> PerformEventT t m ()) -> (Event t a -> RequesterT t (HostFrame t) Identity (HostFrame t) ()) -> Event t a -> PerformEventT t m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> RequesterT t (HostFrame t) Identity (HostFrame t) () forall a. Event t a -> RequesterT t (HostFrame t) Identity (HostFrame t) () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: PerformEventT t m () notReady = RequesterT t (HostFrame t) Identity (HostFrame t) () -> PerformEventT t m () forall {k} t (m :: k) a. RequesterT t (HostFrame t) Identity (HostFrame t) a -> PerformEventT t m a PerformEventT RequesterT t (HostFrame t) Identity (HostFrame t) () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (RequesterT t request response m) where notReadyUntil :: forall a. Event t a -> RequesterT t request response m () notReadyUntil = m () -> RequesterT t request response m () forall (m :: * -> *) a. Monad m => m a -> RequesterT t request response m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> RequesterT t request response m ()) -> (Event t a -> m ()) -> Event t a -> RequesterT t request response m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: RequesterT t request response m () notReady = m () -> RequesterT t request response m () forall (m :: * -> *) a. Monad m => m a -> RequesterT t request response m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady instance NotReady t m => NotReady t (TriggerEventT t m) where notReadyUntil :: forall a. Event t a -> TriggerEventT t m () notReadyUntil = m () -> TriggerEventT t m () forall (m :: * -> *) a. Monad m => m a -> TriggerEventT t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (m () -> TriggerEventT t m ()) -> (Event t a -> m ()) -> Event t a -> TriggerEventT t m () forall b c a. (b -> c) -> (a -> b) -> a -> c . Event t a -> m () forall a. Event t a -> m () forall t (m :: * -> *) a. NotReady t m => Event t a -> m () notReadyUntil notReady :: TriggerEventT t m () notReady = m () -> TriggerEventT t m () forall (m :: * -> *) a. Monad m => m a -> TriggerEventT t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m () forall t (m :: * -> *). NotReady t m => m () notReady