on master help sign in
Remove improper instances from Fold as discussed in #449

https://github.com/composewell/streamly/pull/449#discussion_r396201192

commit619b57444d05700318ef5eb12e3e05626a0f6a29 authoradithyaov <adi.obilisetty@gmail.com> dateTue 24 Mar 2020, 04:55 (7 years ago) parentfceecc3
1 file changed+1−10
src/Streamly/Internal/Data/Fold/Types.hs+1−10
src/Streamly/Internal/Data/Fold/Types.hs+1−10
@@ -80,15 +80,12 @@ simplify :: Fold2 m c a b -> c -> Fold m a b
8080simplify (Fold2 step inject extract) c = Fold step (inject c) extract
8181
8282-- | Maps a function on the output of the fold (the type @b@).
83−instance Applicative m => Functor (Fold m a) where
83+instance Functor m => Functor (Fold m a) where
8484 {-# INLINE fmap #-}
8585 fmap f (Fold step start done) = Fold step start done'
8686 where
8787 done' x = fmap f $! done x
8888
89− {-# INLINE (<$) #-}
90− (<$) b = \_ -> pure b
91−
9289-- | The fold resulting from '<*>' distributes its input to both the argument
9390-- folds and combines their output using the supplied function.
9491instance Applicative m => Applicative (Fold m a) where
@@ -102,12 +99,6 @@ instance Applicative m => Applicative (Fold m a) where
10299 done (Tuple' xL xR) = doneL xL <*> doneR xR
103100 in Fold step begin done
104101
105− {-# INLINE (<*) #-}
106− (<*) m = \_ -> m
107−
108− {-# INLINE (*>) #-}
109− _ *> m = m
110−
111102-- | Combines the outputs of the folds (the type @b@) using their 'Semigroup'
112103-- instances.
113104instance (Semigroup b, Monad m) => Semigroup (Fold m a b) where