on develop help sign in
Re-add sequenceThese
0950b23Ryan Trinkle
src/Reflex/Class.hs+10−9
@@ -75,8 +75,9 @@ module Reflex.Class
75 -- * Miscellaneous convenience functions
75 -- * Miscellaneous convenience functions
76 , ffor
76 , ffor
77 -- * Deprecated functions
77 -- * Deprecated functions
78− , onceE
79 , appendEvents
78 , appendEvents
79+ , onceE
80+ , sequenceThese
80 ) where
81 ) where
81
82
82import Control.Applicative
83import Control.Applicative
@@ -554,14 +555,6 @@ dmapToThese m = case (DMap.lookup LeftTag m, DMap.lookup RightTag m) of
554 (Nothing, Just (Identity b)) -> Just $ That b
555 (Nothing, Just (Identity b)) -> Just $ That b
555 (Just (Identity a), Just (Identity b)) -> Just $ These a b
556 (Just (Identity a), Just (Identity b)) -> Just $ These a b
556
557
557−{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
558−{-# ANN sequenceThese "HLint: ignore Use fmap" #-}
559−sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
560−sequenceThese t = case t of
561− This ma -> liftM This ma
562− These ma mb -> liftM2 These ma mb
563− That mb -> liftM That mb
564−
565instance (Semigroup a, Reflex t) => Semigroup (Event t a) where
558instance (Semigroup a, Reflex t) => Semigroup (Event t a) where
566 (<>) = alignWith (mergeThese (<>))
559 (<>) = alignWith (mergeThese (<>))
567 sconcat = fmap sconcat . mergeList . toList
560 sconcat = fmap sconcat . mergeList . toList
@@ -776,3 +769,11 @@ appendEvents = alignWith $ mergeThese mappend
776{-# DEPRECATED onceE "Use 'headE' instead" #-}
769{-# DEPRECATED onceE "Use 'headE' instead" #-}
777onceE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a)
770onceE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a)
778onceE = headE
771onceE = headE
772+
773+{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
774+{-# ANN sequenceThese "HLint: ignore Use fmap" #-}
775+sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
776+sequenceThese t = case t of
777+ This ma -> liftM This ma
778+ These ma mb -> liftM2 These ma mb
779+ That mb -> liftM That mb