@@ -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 (mempty, (<>))
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 hiding (toList)
70import GHC.Exts hiding (toList)
68import GHC.IORef (IORef (..))
71import GHC.IORef (IORef (..))
@@ -944,8 +947,10 @@ instance Monad (BehaviorM x) where
944 BehaviorM x >> BehaviorM y = BehaviorM $ x >> y
947 BehaviorM x >> BehaviorM y = BehaviorM $ x >> y
945 {-# INLINE return #-}
948 {-# INLINE return #-}
946 return x = BehaviorM $ return x
949 return x = BehaviorM $ return x
950+#if !MIN_VERSION_base(4,13,0)
947 {-# INLINE fail #-}
951 {-# INLINE fail #-}
948 fail s = BehaviorM $ fail s
952 fail s = BehaviorM $ fail s
950data BehaviorSubscribed x a
955data BehaviorSubscribed x a
951 = forall p. BehaviorSubscribedHold (Hold x p)
956 = forall p. BehaviorSubscribedHold (Hold x p)
@@ -2486,8 +2491,10 @@ instance HasSpiderTimeline x => Monad (Reflex.Class.Dynamic (SpiderTimeline x))
2486 x >>= f = SpiderDynamic $ dynamicDynIdentity $ newJoinDyn $ newMapDyn (unSpiderDynamic . f) $ unSpiderDynamic x
2491 x >>= f = SpiderDynamic $ dynamicDynIdentity $ newJoinDyn $ newMapDyn (unSpiderDynamic . f) $ unSpiderDynamic x
2487 {-# INLINE (>>) #-}
2492 {-# INLINE (>>) #-}
2488 (>>) = (*>)
2493 (>>) = (*>)
2494+#if !MIN_VERSION_base(4,13,0)
2489 {-# INLINE fail #-}
2495 {-# INLINE fail #-}
2490 fail _ = error "Dynamic does not support 'fail'"
2496 fail _ = error "Dynamic does not support 'fail'"
2492{-# INLINABLE newJoinDyn #-}
2499{-# INLINABLE newJoinDyn #-}
2493newJoinDyn :: HasSpiderTimeline x => DynamicS x (Identity (DynamicS x (Identity a))) -> Reflex.Spider.Internal.Dyn x (Identity a)
2500newJoinDyn :: HasSpiderTimeline x => DynamicS x (Identity (DynamicS x (Identity a))) -> Reflex.Spider.Internal.Dyn x (Identity a)
@@ -2766,8 +2773,14 @@ instance Monad (SpiderHost x) where
2766 SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
2773 SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
2767 {-# INLINABLE return #-}
2774 {-# INLINABLE return #-}
2768 return x = SpiderHost $ return x
2775 return x = SpiderHost $ return x
2776+#if !MIN_VERSION_base(4,13,0)
2777+ {-# INLINABLE fail #-}
2778+ fail = MonadFail.fail
2781+instance MonadFail (SpiderHost x) where
2769 {-# INLINABLE fail #-}
2782 {-# INLINABLE fail #-}
2770− fail s = SpiderHost $ fail s
2783+ fail s = SpiderHost $ MonadFail.fail s
2772-- | Run an action affecting the global Spider timeline; this will be guarded by
2785-- | Run an action affecting the global Spider timeline; this will be guarded by
2773-- a mutex for that timeline
2786-- a mutex for that timeline
@@ -2789,8 +2802,10 @@ instance Monad (SpiderHostFrame x) where
2789 SpiderHostFrame x >> SpiderHostFrame y = SpiderHostFrame $ x >> y
2802 SpiderHostFrame x >> SpiderHostFrame y = SpiderHostFrame $ x >> y
2790 {-# INLINABLE return #-}
2803 {-# INLINABLE return #-}
2791 return x = SpiderHostFrame $ return x
2804 return x = SpiderHostFrame $ return x
2805+#if !MIN_VERSION_base(4,13,0)
2792 {-# INLINABLE fail #-}
2806 {-# INLINABLE fail #-}
2793 fail s = SpiderHostFrame $ fail s
2807 fail s = SpiderHostFrame $ fail s
2795instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
2810instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
2796 notReadyUntil _ = pure ()
2811 notReadyUntil _ = pure ()