packages feed

list-t 1.0.5.5 → 1.0.5.6

raw patch · 2 files changed

+14/−6 lines, 2 files

Files

library/ListT.hs view
@@ -177,7 +177,11 @@ instance MFunctor ListT where   hoist f = go     where-      go = ListT . f . (fmap . fmap) (bimapPair' id go) . uncons+      go (ListT run) =+        ListT . f $+          run <&> \case+            Just (elem, next) -> Just (elem, go next)+            Nothing -> Nothing  instance MMonad ListT where   embed f (ListT m) =@@ -468,10 +472,14 @@ -- which traverses the stream with an action in the inner monad. {-# INLINEABLE traverse #-} traverse :: Monad m => (a -> m b) -> ListT m a -> ListT m b-traverse f s =-  lift (uncons s)-    >>= mapM (\(h, t) -> lift (f h) >>= \h' -> cons h' (traverse f t))-    >>= maybe mzero return+traverse f =+  go+  where+    go (ListT run) =+      ListT $+        run >>= \case+          Nothing -> return Nothing+          Just (a, next) -> f a <&> \b -> Just (b, go next)  -- | -- A transformation,
list-t.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name:          list-t-version:       1.0.5.5+version:       1.0.5.6 synopsis:      ListT done right description:   A correct implementation of the list monad-transformer.