on master help sign in
Remove the MonadTrans instance for concurrent types
cd0c2fdHarendra Kumar
src/Streamly/Internal/Data/Stream/MkType.hs+13−10
@@ -334,10 +334,14 @@ monadthrowInstance _Type =
334 [ clause
334 [ clause
335 []
335 []
336 (normalB
336 (normalB
337+ (infixE
338+ (Just (conE _Type))
339+ (varE _dotOp)
340+ (Just
337− (infixE
341+ (infixE
338− (Just (varE _lift))
342+ (Just (varE (mkName "Stream.fromEffect")))
339− (varE _dotOp)
343+ (varE _dotOp)
340− (Just (varE _throwM))))
344+ (Just (varE _throwM))))))
341 []
345 []
342 ]
346 ]
343 ]
347 ]
@@ -589,11 +593,11 @@ mkZipType dtNameStr apOpStr isConcurrent =
589-- instance (Monad (Parallel m), MonadIO m) => MonadIO (Parallel m)
593-- instance (Monad (Parallel m), MonadIO m) => MonadIO (Parallel m)
590-- where {{-# INLINE liftIO #-};
594-- where {{-# INLINE liftIO #-};
591-- liftIO = Parallel . (Stream.fromEffect . liftIO)}
595-- liftIO = Parallel . (Stream.fromEffect . liftIO)}
592−-- instance MonadTrans Parallel
593−-- where {{-# INLINE lift #-}; lift = Parallel . Stream.fromEffect}
594-- instance (Monad (Parallel m),
596-- instance (Monad (Parallel m),
595-- MonadThrow m) => MonadThrow (Parallel m)
597-- MonadThrow m) => MonadThrow (Parallel m)
596−-- where {{-# INLINE throwM #-}; throwM = lift . throwM}
598+-- where {{-# INLINE throwM #-};
599+-- throwM = Parallel . (Stream.fromEffect . throwM)}
600+
597mkCrossType
601mkCrossType
598 :: String -- ^ Name of the type
602 :: String -- ^ Name of the type
599 -> String -- ^ Function to use for (>>=)
603 -> String -- ^ Function to use for (>>=)
@@ -613,7 +617,7 @@ mkCrossType dtNameStr bindOpStr isConcurrent =
613 , readInstance _Type
617 , readInstance _Type
614 ]
618 ]
615 else []
619 else []
616− , sequence
620+ , sequence $
617 [ functorInstance _Type
621 [ functorInstance _Type
618 , mkStreamMonad dtNameStr classConstraints bindOpStr
622 , mkStreamMonad dtNameStr classConstraints bindOpStr
619 , mkStreamApplicative
623 , mkStreamApplicative
@@ -623,10 +627,9 @@ mkCrossType dtNameStr bindOpStr isConcurrent =
623 "Stream.fromPure"
627 "Stream.fromPure"
624 "ap"
628 "ap"
625 , monadioInstance _Type
629 , monadioInstance _Type
626− , monadtransInstance _Type
627 , monadthrowInstance _Type
630 , monadthrowInstance _Type
628 -- , monadreaderInstance _Type
631 -- , monadreaderInstance _Type
629− ]
632+ ] ++ [monadtransInstance _Type | not isConcurrent]
630 ]
633 ]
631
634
632 where
635 where