@@ -22,6 +22,7 @@ import Data.Maybe
22import Data.IntMap (IntMap)
22import Data.IntMap (IntMap)
23import qualified Data.IntMap as IntMap
23import qualified Data.IntMap as IntMap
24import Control.Monad.Ref
24import Control.Monad.Ref
25+import Control.Monad.Exception
25import Data.Monoid ((<>))
26import Data.Monoid ((<>))
27import System.IO.Unsafe
28import System.IO.Unsafe
@@ -223,7 +224,7 @@ data Root a
223data SomeHoldInit = forall a. SomeHoldInit (Event a) (Hold a)
224data SomeHoldInit = forall a. SomeHoldInit (Event a) (Hold a)
225-- EventM can do everything BehaviorM can, plus create holds
226-- EventM can do everything BehaviorM can, plus create holds
226−newtype EventM a = EventM { unEventM :: ReaderT EventEnv IO a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO) -- The environment should be Nothing if we are not in a frame, and Just if we are - in which case it is a list of assignments to be done after the frame is over
227+newtype EventM a = EventM { unEventM :: ReaderT EventEnv IO a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO, MonadException, MonadAsyncException) -- The environment should be Nothing if we are not in a frame, and Just if we are - in which case it is a list of assignments to be done after the frame is over
228data PushSubscribed a b
229data PushSubscribed a b
229 = PushSubscribed { pushSubscribedOccurrence :: !(IORef (Maybe b)) -- If the current height is less than our height, this should always be Nothing; during our height, this will get filled in at some point, always before our children are notified; after our height, this will be filled in with the correct value (Nothing if we are not firing, Just if we are)
230 = PushSubscribed { pushSubscribedOccurrence :: !(IORef (Maybe b)) -- If the current height is less than our height, this should always be Nothing; during our height, this will get filled in at some point, always before our children are notified; after our height, this will be filled in with the correct value (Nothing if we are not firing, Just if we are)
@@ -1345,9 +1346,9 @@ instance MonadAtomicRef EventM where
1345 {-# INLINE atomicModifyRef #-}
1346 {-# INLINE atomicModifyRef #-}
1346 atomicModifyRef r f = liftIO $ atomicModifyRef r f
1347 atomicModifyRef r f = liftIO $ atomicModifyRef r f
1348−newtype SpiderHost a = SpiderHost { runSpiderHost :: IO a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO)
1349+newtype SpiderHost a = SpiderHost { runSpiderHost :: IO a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO, MonadException, MonadAsyncException)
1350−newtype SpiderHostFrame a = SpiderHostFrame { runSpiderHostFrame :: EventM a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO)
1351+newtype SpiderHostFrame a = SpiderHostFrame { runSpiderHostFrame :: EventM a } deriving (Functor, Applicative, Monad, MonadFix, MonadIO, MonadException, MonadAsyncException)
1352instance R.MonadSample Spider SpiderHostFrame where
1353instance R.MonadSample Spider SpiderHostFrame where
1353 sample = SpiderHostFrame . R.sample --TODO: This can cause problems with laziness, so we should get rid of it if we can
1354 sample = SpiderHostFrame . R.sample --TODO: This can cause problems with laziness, so we should get rid of it if we can