@@ -67,6 +67,7 @@ where
6767
6868import Control.Applicative (liftA2)
6969import Control.Monad (ap, when)
70+import Control.Monad.Catch (MonadThrow, throwM)
7071import Control.Monad.Trans (lift, MonadTrans)
7172import Data.Functor.Identity (Identity(..))
7273import GHC.Base (build)
@@ -247,6 +248,12 @@ instance Monad m => Monad (Stream m) where
247248 {-# INLINE (>>=) #-}
248249 (>>=) = flip concatMap
249250
251+instance MonadTrans Stream where
252+ lift = yieldM
253+
254+instance (MonadThrow m) => MonadThrow (Stream m) where
255+ throwM = lift . throwM
256+
250257-- XXX Use of SPEC constructor in folds causes 2x performance degradation in
251258-- one shot operations, but helps immensely in operations composed of multiple
252259-- combinators or the same combinator many times. There seems to be an