on 9cc8f7b help sign in
67 lines 2.2 kB history raw
1{-# LANGUAGE CPP #-}
2{-# LANGUAGE DefaultSignatures #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE FunctionalDependencies #-}
5{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE FlexibleInstances #-}
7{-# LANGUAGE UndecidableInstances #-}
8#ifdef USE_REFLEX_OPTIMIZER
9{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
10#endif
11module Reflex.NotReady.Class
12 ( NotReady(..)
13 ) where
15import Control.Monad.Trans
16import Control.Monad.Reader (ReaderT)
18import Reflex.Class
19import Reflex.Host.Class
20import Reflex.PostBuild.Base (PostBuildT)
21import Reflex.EventWriter (EventWriterT)
22import Reflex.DynamicWriter (DynamicWriterT)
23import Reflex.Query.Base (QueryT)
24import Reflex.Requester.Base (RequesterT)
25import Reflex.PerformEvent.Base (PerformEventT(..))
26import Reflex.TriggerEvent.Base (TriggerEventT)
28class Monad m => NotReady t m | m -> t where
29 notReadyUntil :: Event t a -> m ()
30 default notReadyUntil :: (MonadTrans f, m ~ f m', NotReady t m') => Event t a -> m ()
31 notReadyUntil = lift . notReadyUntil
33 notReady :: m ()
34 default notReady :: (MonadTrans f, m ~ f m', NotReady t m') => m ()
35 notReady = lift notReady
37instance NotReady t m => NotReady t (ReaderT r m) where
38 notReadyUntil = lift . notReadyUntil
39 notReady = lift notReady
41instance NotReady t m => NotReady t (PostBuildT t m) where
42 notReadyUntil = lift . notReadyUntil
43 notReady = lift notReady
45instance NotReady t m => NotReady t (EventWriterT t w m) where
46 notReadyUntil = lift . notReadyUntil
47 notReady = lift notReady
49instance NotReady t m => NotReady t (DynamicWriterT t w m) where
50 notReadyUntil = lift . notReadyUntil
51 notReady = lift notReady
53instance NotReady t m => NotReady t (QueryT t q m) where
54 notReadyUntil = lift . notReadyUntil
55 notReady = lift notReady
57instance (ReflexHost t, NotReady t (HostFrame t)) => NotReady t (PerformEventT t m) where
58 notReadyUntil = PerformEventT . notReadyUntil
59 notReady = PerformEventT notReady
61instance NotReady t m => NotReady t (RequesterT t request response m) where
62 notReadyUntil = lift . notReadyUntil
63 notReady = lift notReady
65instance NotReady t m => NotReady t (TriggerEventT t m) where
66 notReadyUntil = lift . notReadyUntil
67 notReady = lift notReady