@@ -43,6 +43,8 @@ import Control.Monad.Reader.Class
43import Control.Monad.IO.Class
43import Control.Monad.IO.Class
44import Control.Monad.ReaderIO
44import Control.Monad.ReaderIO
45import Control.Monad.Ref
45import Control.Monad.Ref
46+import Control.Monad.Fail (MonadFail)
47+import qualified Control.Monad.Fail as MonadFail
46import Data.Align
48import Data.Align
47import Data.Coerce
49import Data.Coerce
48import Data.Dependent.Map (DMap, DSum (..))
50import Data.Dependent.Map (DMap, DSum (..))
@@ -63,6 +65,7 @@ import Data.Monoid ((<>))
63import Data.Proxy
65import Data.Proxy
64import Data.These
66import Data.These
65import Data.Traversable
67import Data.Traversable
68+import Data.Type.Equality ((:~:)(Refl))
66import Data.Witherable (Filterable, mapMaybe)
69import Data.Witherable (Filterable, mapMaybe)
67import GHC.Exts
70import GHC.Exts
68import GHC.IORef (IORef (..))
71import GHC.IORef (IORef (..))
@@ -103,6 +106,7 @@ import qualified Reflex.Host.Class
103import Reflex.NotReady.Class
106import Reflex.NotReady.Class
104import Reflex.Patch
107import Reflex.Patch
105import qualified Reflex.Patch.DMapWithMove as PatchDMapWithMove
108import qualified Reflex.Patch.DMapWithMove as PatchDMapWithMove
109+import Reflex.PerformEvent.Base (PerformEventT)
107#ifdef DEBUG_TRACE_EVENTS
111#ifdef DEBUG_TRACE_EVENTS
108import qualified Data.ByteString.Char8 as BS8
112import qualified Data.ByteString.Char8 as BS8
@@ -971,8 +975,10 @@ instance Monad (BehaviorM x) where
971 BehaviorM x >> BehaviorM y = BehaviorM $ x >> y
975 BehaviorM x >> BehaviorM y = BehaviorM $ x >> y
972 {-# INLINE return #-}
976 {-# INLINE return #-}
973 return x = BehaviorM $ return x
977 return x = BehaviorM $ return x
978+#if !MIN_VERSION_base(4,13,0)
974 {-# INLINE fail #-}
979 {-# INLINE fail #-}
975 fail s = BehaviorM $ fail s
980 fail s = BehaviorM $ fail s
977data BehaviorSubscribed x a
983data BehaviorSubscribed x a
978 = forall p. BehaviorSubscribedHold (Hold x p)
984 = forall p. BehaviorSubscribedHold (Hold x p)
@@ -2356,8 +2362,10 @@ instance HasSpiderTimeline x => Monad (Reflex.Class.Dynamic (SpiderTimeline x))
2356 x >>= f = SpiderDynamic $ dynamicDynIdentity $ newJoinDyn $ newMapDyn (unSpiderDynamic . f) $ unSpiderDynamic x
2362 x >>= f = SpiderDynamic $ dynamicDynIdentity $ newJoinDyn $ newMapDyn (unSpiderDynamic . f) $ unSpiderDynamic x
2357 {-# INLINE (>>) #-}
2363 {-# INLINE (>>) #-}
2358 (>>) = (*>)
2364 (>>) = (*>)
2365+#if !MIN_VERSION_base(4,13,0)
2359 {-# INLINE fail #-}
2366 {-# INLINE fail #-}
2360 fail _ = error "Dynamic does not support 'fail'"
2367 fail _ = error "Dynamic does not support 'fail'"
2362{-# INLINABLE newJoinDyn #-}
2370{-# INLINABLE newJoinDyn #-}
2363newJoinDyn :: HasSpiderTimeline x => DynamicS x (Identity (DynamicS x (Identity a))) -> Reflex.Spider.Internal.Dyn x (Identity a)
2371newJoinDyn :: HasSpiderTimeline x => DynamicS x (Identity (DynamicS x (Identity a))) -> Reflex.Spider.Internal.Dyn x (Identity a)
@@ -2636,8 +2644,14 @@ instance Monad (SpiderHost x) where
2636 SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
2644 SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
2637 {-# INLINABLE return #-}
2645 {-# INLINABLE return #-}
2638 return x = SpiderHost $ return x
2646 return x = SpiderHost $ return x
2647+#if !MIN_VERSION_base(4,13,0)
2648+ {-# INLINABLE fail #-}
2649+ fail = MonadFail.fail
2652+instance MonadFail (SpiderHost x) where
2639 {-# INLINABLE fail #-}
2653 {-# INLINABLE fail #-}
2640− fail s = SpiderHost $ fail s
2654+ fail s = SpiderHost $ MonadFail.fail s
2642-- | Run an action affecting the global Spider timeline; this will be guarded by
2656-- | Run an action affecting the global Spider timeline; this will be guarded by
2643-- a mutex for that timeline
2657-- a mutex for that timeline
@@ -2659,8 +2673,10 @@ instance Monad (SpiderHostFrame x) where
2659 SpiderHostFrame x >> SpiderHostFrame y = SpiderHostFrame $ x >> y
2673 SpiderHostFrame x >> SpiderHostFrame y = SpiderHostFrame $ x >> y
2660 {-# INLINABLE return #-}
2674 {-# INLINABLE return #-}
2661 return x = SpiderHostFrame $ return x
2675 return x = SpiderHostFrame $ return x
2676+#if !MIN_VERSION_base(4,13,0)
2662 {-# INLINABLE fail #-}
2677 {-# INLINABLE fail #-}
2663 fail s = SpiderHostFrame $ fail s
2678 fail s = SpiderHostFrame $ fail s
2665instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
2681instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
2666 notReadyUntil _ = pure ()
2682 notReadyUntil _ = pure ()
@@ -2705,3 +2721,11 @@ instance MonadAtomicRef (SpiderHostFrame x) where
2705instance PrimMonad (SpiderHostFrame x) where
2721instance PrimMonad (SpiderHostFrame x) where
2706 type PrimState (SpiderHostFrame x) = PrimState IO
2722 type PrimState (SpiderHostFrame x) = PrimState IO
2707 primitive = SpiderHostFrame . EventM . primitive
2723 primitive = SpiderHostFrame . EventM . primitive
2725+instance NotReady (SpiderTimeline x) (SpiderHost x) where
2726+ notReadyUntil _ = return ()
2727+ notReady = return ()
2729+instance HasSpiderTimeline x => NotReady (SpiderTimeline x) (PerformEventT (SpiderTimeline x) (SpiderHost x)) where
2730+ notReadyUntil _ = return ()
2731+ notReady = return ()