foldl-transduce 0.1.2.1 → 0.1.2.2
raw patch · 3 files changed
+7/−7 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Foldl.Transduce: instance GHC.Base.Monad m => Data.Bifunctor.Bifunctor (Control.Foldl.Transduce.TransducerM m i)
+ Control.Foldl.Transduce: instance (GHC.Base.Functor m, GHC.Base.Monad m) => Data.Bifunctor.Bifunctor (Control.Foldl.Transduce.TransducerM m i)
- Control.Foldl.Transduce: foldsM :: Splitter i -> FoldM m i b -> TransductionM m i b
+ Control.Foldl.Transduce: foldsM :: (Applicative m, Monad m) => Splitter i -> FoldM m i b -> TransductionM m i b
- Control.Foldl.Transduce: surroundIO :: (Foldable p, Foldable s, MonadIO m) => m (p a) -> m (s a) -> TransducerM m a a ()
+ Control.Foldl.Transduce: surroundIO :: (Foldable p, Foldable s, Functor m, MonadIO m) => m (p a) -> m (s a) -> TransducerM m a a ()
Files
- foldl-transduce.cabal +1/−1
- src/Control/Foldl/Transduce.hs +4/−4
- src/Control/Foldl/Transduce/Text.hs +2/−2
foldl-transduce.cabal view
@@ -1,5 +1,5 @@ Name: foldl-transduce-Version: 0.1.2.1+Version: 0.1.2.2 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3
src/Control/Foldl/Transduce.hs view
@@ -86,7 +86,7 @@ instance Monad m => Extend (FoldM m a) where duplicated (FoldM step begin done) = - FoldM step begin (\x -> pure $! FoldM step (pure x) done)+ FoldM step begin (\x -> return $! FoldM step (return x) done) {-# INLINABLE duplicated #-} ------------------------------------------------------------------------------@@ -140,7 +140,7 @@ let r' = f r return $! (r' `seq` (r', os)) -instance Monad m => Bifunctor (TransducerM m i) where+instance (Functor m, Monad m) => Bifunctor (TransducerM m i) where first f (TransducerM step begin done) = TransducerM (fmap (fmap (fmap (fmap f))) . step) begin (fmap (fmap (fmap f)) . done) second f w = fmap f w@@ -216,7 +216,7 @@ >>> L.foldM (transduceM (surroundIO (return "prefix") (return "suffix")) (L.generalize L.list)) "middle" "prefixmiddlesuffix" -}-surroundIO :: (Foldable p, Foldable s, MonadIO m) +surroundIO :: (Foldable p, Foldable s, Functor m, MonadIO m) => m (p a) -> m (s a) -> TransducerM m a a ()@@ -429,7 +429,7 @@ folds :: Splitter i -> Fold i b -> Transduction i b folds splitter f = groups splitter (transduce (chokepoint f)) -foldsM :: Splitter i -> FoldM m i b -> TransductionM m i b+foldsM :: (Applicative m,Monad m) => Splitter i -> FoldM m i b -> TransductionM m i b foldsM splitter f = groupsM splitter (transduceM (chokepointM f)) ------------------------------------------------------------------------------
src/Control/Foldl/Transduce/Text.hs view
@@ -110,7 +110,7 @@ decoderE :: MonadIO m => (T.OnDecodeError -> B.ByteString -> T.Decoding) -> L.TransducerM (ExceptT T.UnicodeException m) B.ByteString T.Text () -decoderE next = L.TransducerM step (pure (Pair mempty next')) done+decoderE next = L.TransducerM step (return (Pair mempty next')) done where step (Pair _ next1) i = do emc <- liftIO . try . evaluate $ next1 i @@ -128,7 +128,7 @@ Left ue -> do throwE ue Right mc -> do- return ((), foldMap (pure . T.singleton) mc)+ return ((), foldMap (return . T.singleton) mc) next' = next T.strictDecode onLeftovers' = T.strictDecode "leftovers" Nothing