@@ -558,41 +558,9 @@ instance (Monoid a, MonadAsync m) => Monoid (AsyncT m a) where
558558 mempty = return mempty
559559
560560------------------------------------------------------------------------------
561−-- MonadIO
561+-- Num
562562------------------------------------------------------------------------------
563563
564−instance MonadAsync m => MonadIO (AsyncT m) where
565− liftIO mx = AsyncT $ liftIO mx >>= return . Just
566−
567−-------------------------------------------------------------------------------
568−-- AsyncT transformer
569−-------------------------------------------------------------------------------
570−
571−instance MonadTrans AsyncT where
572− lift mx = AsyncT $ lift mx >>= return . Just
573−
574−instance MonadTransControl AsyncT where
575− type StT AsyncT a = (Maybe a, Context)
576− liftWith f = AsyncT $ StateT $ \s ->
577− liftM (\x -> (Just x, s))
578− (f $ \t -> runStateT (runAsyncT t) s)
579− restoreT = AsyncT . StateT . const
580− {-# INLINABLE liftWith #-}
581− {-# INLINABLE restoreT #-}
582−
583−instance (MonadBase b m, MonadAsync m) => MonadBase b (AsyncT m) where
584− liftBase = liftBaseDefault
585−
586−instance (MonadBaseControl b m, MonadAsync m) => MonadBaseControl b (AsyncT m) where
587− type StM (AsyncT m) a = ComposeSt AsyncT m a
588− liftBaseWith = defaultLiftBaseWith
589− restoreM = defaultRestoreM
590− {-# INLINABLE liftBaseWith #-}
591− {-# INLINABLE restoreM #-}
592−
593−instance MonadAsync m => MonadThrow (AsyncT m) where
594− throwM e = lift $ throwM e
595−
596564instance (Num a, Monad (AsyncT m)) => Num (AsyncT m a) where
597565 fromInteger = return . fromInteger
598566 mf + mg = (+) <$> mf <*> mg
@@ -646,3 +614,39 @@ thenDiscard ma mb = AsyncT $ do
646614-- | Same as 'thenDiscard'.
647615(>>*) :: MonadAsync m => AsyncT m a -> AsyncT m b -> AsyncT m a
648616(>>*) = thenDiscard
617+
618+------------------------------------------------------------------------------
619+-- MonadIO
620+------------------------------------------------------------------------------
621+
622+instance MonadAsync m => MonadIO (AsyncT m) where
623+ liftIO mx = AsyncT $ liftIO mx >>= return . Just
624+
625+-------------------------------------------------------------------------------
626+-- AsyncT transformer
627+-------------------------------------------------------------------------------
628+
629+instance MonadTrans AsyncT where
630+ lift mx = AsyncT $ lift mx >>= return . Just
631+
632+instance MonadTransControl AsyncT where
633+ type StT AsyncT a = (Maybe a, Context)
634+ liftWith f = AsyncT $ StateT $ \s ->
635+ liftM (\x -> (Just x, s))
636+ (f $ \t -> runStateT (runAsyncT t) s)
637+ restoreT = AsyncT . StateT . const
638+ {-# INLINABLE liftWith #-}
639+ {-# INLINABLE restoreT #-}
640+
641+instance (MonadBase b m, MonadAsync m) => MonadBase b (AsyncT m) where
642+ liftBase = liftBaseDefault
643+
644+instance (MonadBaseControl b m, MonadAsync m) => MonadBaseControl b (AsyncT m) where
645+ type StM (AsyncT m) a = ComposeSt AsyncT m a
646+ liftBaseWith = defaultLiftBaseWith
647+ restoreM = defaultRestoreM
648+ {-# INLINABLE liftBaseWith #-}
649+ {-# INLINABLE restoreM #-}
650+
651+instance MonadAsync m => MonadThrow (AsyncT m) where
652+ throwM e = lift $ throwM e