@@ -229,7 +229,6 @@ module Streamly.Internal.Data.Fold.Types
229229 )
230230where
231231
232−import Control.Applicative (liftA2)
233232import Control.Concurrent (threadDelay, forkIO, killThread)
234233import Control.Concurrent.MVar (MVar, newMVar, swapMVar, readMVar)
235234import Control.Exception (SomeException(..), catch, mask)
@@ -573,26 +572,6 @@ data GenericRunner sL sR bL bR
573572 | RunLeft !sL !bR
574573 | RunRight !bL !sR
575574
576−-- | The fold resulting from '<*>' distributes its input to both the argument
577−-- folds and combines their output using the supplied function.
578−--
579−-- __Note:__ The Applicative behaviour will change in the next major release.
580−--
581−instance Monad m => Applicative (Fold m a) where
582− {-# INLINE pure #-}
583− pure = yield
584−
585− -- | __Notice:__ In the next major release the behaviour of @<*>@ for folds
586− -- will be updated from 'teeWith' to 'splitWith' to reflect it's similarity
587− -- with parsers.
588− {-# INLINE (<*>) #-}
589− (<*>) = teeWith ($)
590−
591−#if MIN_VERSION_base(4,10,0)
592− {-# INLINE liftA2 #-}
593− liftA2 f x = (<*>) (fmap f x)
594−#endif
595−
596575-- | @teeWith k f1 f2@ distributes its input to both @f1@ and @f2@ until both
597576-- of them terminate and combines their output using @k@.
598577--
@@ -746,111 +725,6 @@ concatMap f (Fold stepa initiala extracta) = Fold stepc initialc extractc
746725 Partial s -> e s
747726 Done c -> return c
748727
749−-- | Combines the outputs of the folds (the type @b@) using their 'Semigroup'
750−-- instances.
751−instance (Semigroup b, Monad m) => Semigroup (Fold m a b) where
752− {-# INLINE (<>) #-}
753− (<>) = liftA2 (<>)
754−
755−-- | Combines the outputs of the folds (the type @b@) using their 'Monoid'
756−-- instances.
757−instance (Semigroup b, Monoid b, Monad m) => Monoid (Fold m a b) where
758− {-# INLINE mempty #-}
759− mempty = pure mempty
760−
761− {-# INLINE mappend #-}
762− mappend = (<>)
763−
764−-- | Combines the fold outputs (type @b@) using their 'Num' instances.
765−instance (Monad m, Num b) => Num (Fold m a b) where
766− {-# INLINE fromInteger #-}
767− fromInteger = pure . fromInteger
768−
769− {-# INLINE negate #-}
770− negate = fmap negate
771−
772− {-# INLINE abs #-}
773− abs = fmap abs
774−
775− {-# INLINE signum #-}
776− signum = fmap signum
777−
778− {-# INLINE (+) #-}
779− (+) = liftA2 (+)
780−
781− {-# INLINE (*) #-}
782− (*) = liftA2 (*)
783−
784− {-# INLINE (-) #-}
785− (-) = liftA2 (-)
786−
787−-- | Combines the fold outputs (type @b@) using their 'Fractional' instances.
788−instance (Monad m, Fractional b) => Fractional (Fold m a b) where
789− {-# INLINE fromRational #-}
790− fromRational = pure . fromRational
791−
792− {-# INLINE recip #-}
793− recip = fmap recip
794−
795− {-# INLINE (/) #-}
796− (/) = liftA2 (/)
797−
798−-- | Combines the fold outputs using their 'Floating' instances.
799−instance (Monad m, Floating b) => Floating (Fold m a b) where
800− {-# INLINE pi #-}
801− pi = pure pi
802−
803− {-# INLINE exp #-}
804− exp = fmap exp
805−
806− {-# INLINE sqrt #-}
807− sqrt = fmap sqrt
808−
809− {-# INLINE log #-}
810− log = fmap log
811−
812− {-# INLINE sin #-}
813− sin = fmap sin
814−
815− {-# INLINE tan #-}
816− tan = fmap tan
817−
818− {-# INLINE cos #-}
819− cos = fmap cos
820−
821− {-# INLINE asin #-}
822− asin = fmap asin
823−
824− {-# INLINE atan #-}
825− atan = fmap atan
826−
827− {-# INLINE acos #-}
828− acos = fmap acos
829−
830− {-# INLINE sinh #-}
831− sinh = fmap sinh
832−
833− {-# INLINE tanh #-}
834− tanh = fmap tanh
835−
836− {-# INLINE cosh #-}
837− cosh = fmap cosh
838−
839− {-# INLINE asinh #-}
840− asinh = fmap asinh
841−
842− {-# INLINE atanh #-}
843− atanh = fmap atanh
844−
845− {-# INLINE acosh #-}
846− acosh = fmap acosh
847−
848− {-# INLINE (**) #-}
849− (**) = liftA2 (**)
850−
851− {-# INLINE logBase #-}
852− logBase = liftA2 logBase
853−
854728------------------------------------------------------------------------------
855729-- Internal APIs
856730------------------------------------------------------------------------------