@@ -43,6 +43,8 @@ import Control.Monad.Reader.Class
4343import Control.Monad.IO.Class
4444import Control.Monad.ReaderIO
4545import Control.Monad.Ref
46+import Control.Monad.Fail (MonadFail)
47+import qualified Control.Monad.Fail as MonadFail
4648import Data.Align
4749import Data.Coerce
4850import Data.Dependent.Map (DMap, DSum (..))
@@ -63,6 +65,7 @@ import Data.Monoid ((<>))
6365import Data.Proxy
6466import Data.These
6567import Data.Traversable
68+import Data.Type.Equality ((:~:)(Refl))
6669import Data.Witherable (Filterable, mapMaybe)
6770import GHC.Exts
6871import GHC.IORef (IORef (..))
@@ -103,6 +106,7 @@ import qualified Reflex.Host.Class
103106import Reflex.NotReady.Class
104107import Reflex.Patch
105108import qualified Reflex.Patch.DMapWithMove as PatchDMapWithMove
109+import Reflex.PerformEvent.Base (PerformEventT)
106110
107111#ifdef DEBUG_TRACE_EVENTS
108112import qualified Data.ByteString.Char8 as BS8
@@ -971,8 +975,10 @@ instance Monad (BehaviorM x) where
971975 BehaviorM x >> BehaviorM y = BehaviorM $ x >> y
972976 {-# INLINE return #-}
973977 return x = BehaviorM $ return x
978+#if !MIN_VERSION_base(4,13,0)
974979 {-# INLINE fail #-}
975980 fail s = BehaviorM $ fail s
981+#endif
976982
977983data BehaviorSubscribed x a
978984 = forall p. BehaviorSubscribedHold (Hold x p)
@@ -2356,8 +2362,10 @@ instance HasSpiderTimeline x => Monad (Reflex.Class.Dynamic (SpiderTimeline x))
23562362 x >>= f = SpiderDynamic $ dynamicDynIdentity $ newJoinDyn $ newMapDyn (unSpiderDynamic . f) $ unSpiderDynamic x
23572363 {-# INLINE (>>) #-}
23582364 (>>) = (*>)
2365+#if !MIN_VERSION_base(4,13,0)
23592366 {-# INLINE fail #-}
23602367 fail _ = error "Dynamic does not support 'fail'"
2368+#endif
23612369
23622370{-# INLINABLE newJoinDyn #-}
23632371newJoinDyn :: 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
26362644 SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
26372645 {-# INLINABLE return #-}
26382646 return x = SpiderHost $ return x
2647+#if !MIN_VERSION_base(4,13,0)
2648+ {-# INLINABLE fail #-}
2649+ fail = MonadFail.fail
2650+#endif
2651+
2652+instance MonadFail (SpiderHost x) where
26392653 {-# INLINABLE fail #-}
2640− fail s = SpiderHost $ fail s
2654+ fail s = SpiderHost $ MonadFail.fail s
26412655
26422656-- | Run an action affecting the global Spider timeline; this will be guarded by
26432657-- a mutex for that timeline
@@ -2659,8 +2673,10 @@ instance Monad (SpiderHostFrame x) where
26592673 SpiderHostFrame x >> SpiderHostFrame y = SpiderHostFrame $ x >> y
26602674 {-# INLINABLE return #-}
26612675 return x = SpiderHostFrame $ return x
2676+#if !MIN_VERSION_base(4,13,0)
26622677 {-# INLINABLE fail #-}
26632678 fail s = SpiderHostFrame $ fail s
2679+#endif
26642680
26652681instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
26662682 notReadyUntil _ = pure ()
@@ -2705,3 +2721,11 @@ instance MonadAtomicRef (SpiderHostFrame x) where
27052721instance PrimMonad (SpiderHostFrame x) where
27062722 type PrimState (SpiderHostFrame x) = PrimState IO
27072723 primitive = SpiderHostFrame . EventM . primitive
2724+
2725+instance NotReady (SpiderTimeline x) (SpiderHost x) where
2726+ notReadyUntil _ = return ()
2727+ notReady = return ()
2728+
2729+instance HasSpiderTimeline x => NotReady (SpiderTimeline x) (PerformEventT (SpiderTimeline x) (SpiderHost x)) where
2730+ notReadyUntil _ = return ()
2731+ notReady = return ()