Skip to content

Commit 4c2f164

Browse files
committed
Define MonadFail before 8.8.
Make a smoother transition
1 parent c2346ca commit 4c2f164

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/Reflex/Spider/Internal.hs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import Control.Monad.Reader.Class
4343
import Control.Monad.IO.Class
4444
import Control.Monad.ReaderIO
4545
import Control.Monad.Ref
46+
import qualified Control.Monad.Fail as MonadFail
4647
import Data.Align
4748
import Data.Coerce
4849
import Data.Dependent.Map (DMap, DSum (..))
@@ -974,9 +975,13 @@ instance Monad (BehaviorM x) where
974975
return x = BehaviorM $ return x
975976
#if !MIN_VERSION_base(4,13,0)
976977
{-# INLINE fail #-}
977-
fail s = BehaviorM $ fail s
978+
fail s = MonadFail.fail
978979
#endif
979980

981+
instance MonadFail (SpiderHost x) where
982+
{-# INLINABLE fail #-}
983+
fail s = BehaviorM $ fail s
984+
980985
data BehaviorSubscribed x a
981986
= forall p. BehaviorSubscribedHold (Hold x p)
982987
| BehaviorSubscribedPull (PullSubscribed x a)
@@ -2641,10 +2646,12 @@ instance Monad (SpiderHost x) where
26412646
SpiderHost x >> SpiderHost y = SpiderHost $ x >> y
26422647
{-# INLINABLE return #-}
26432648
return x = SpiderHost $ return x
2644-
#if MIN_VERSION_base(4,13,0)
2649+
#if !MIN_VERSION_base(4,13,0)
2650+
{-# INLINABLE fail #-}
2651+
fail s = MonadFail.fail
2652+
#endif
26452653

26462654
instance MonadFail (SpiderHost x) where
2647-
#endif
26482655
{-# INLINABLE fail #-}
26492656
fail s = SpiderHost $ fail s
26502657

@@ -2670,9 +2677,13 @@ instance Monad (SpiderHostFrame x) where
26702677
return x = SpiderHostFrame $ return x
26712678
#if !MIN_VERSION_base(4,13,0)
26722679
{-# INLINABLE fail #-}
2673-
fail s = SpiderHostFrame $ fail s
2680+
fail s = MonadFail.fail
26742681
#endif
26752682

2683+
instance MonadFail (SpiderHostFrame x) where
2684+
{-# INLINABLE fail #-}
2685+
fail s = SpiderHostFrame $ fail s
2686+
26762687
instance NotReady (SpiderTimeline x) (SpiderHostFrame x) where
26772688
notReadyUntil _ = pure ()
26782689
notReady = pure ()
@@ -2723,4 +2734,4 @@ instance NotReady (SpiderTimeline x) (SpiderHost x) where
27232734

27242735
instance HasSpiderTimeline x => NotReady (SpiderTimeline x) (PerformEventT (SpiderTimeline x) (SpiderHost x)) where
27252736
notReadyUntil _ = return ()
2726-
notReady = return ()
2737+
notReady = return ()

0 commit comments

Comments
 (0)