packages feed

ListT 0.1.0.0 → 0.1.1.0

raw patch · 2 files changed

+17/−11 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.Monad.Trans.List: instance GHC.Base.Monad m => GHC.Base.Alternative (Control.Monad.Trans.List.ListT m)
- Control.Monad.Trans.List: instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Trans.List.ListT m)
+ Control.Monad.Trans.List: instance GHC.Base.Applicative p => GHC.Base.Alternative (Control.Monad.Trans.List.ListT p)
+ Control.Monad.Trans.List: instance GHC.Base.Applicative p => GHC.Base.Applicative (Control.Monad.Trans.List.ListT p)

Files

Control/Monad/Trans/List.hs view
@@ -24,10 +24,13 @@ instance MonadTrans ListT where lift = ListT . fmap (Just . flip (,) empty)  instance Eq1 m => Eq1 (ListT m) where-    liftEq (==) (ListT x) (ListT y) = (liftEq . liftEq) (\ (x, xs) (y, ys) -> x == y && liftEq (==) xs ys) x y+    liftEq (==) (ListT x) (ListT y) =+        (liftEq . liftEq) (\ (x, xs) (y, ys) -> x == y && liftEq (==) xs ys) x y  instance Ord1 m => Ord1 (ListT m) where-    liftCompare cmp (ListT x) (ListT y) = (liftCompare . liftCompare) (\ (x, xs) (y, ys) -> x `cmp` y <> liftCompare cmp xs ys) x y+    liftCompare cmp (ListT x) (ListT y) =+        (liftCompare . liftCompare) (\ (x, xs) (y, ys) ->+                                     x `cmp` y <> liftCompare cmp xs ys) x y  instance Show1 m => Show1 (ListT m) where     liftShowsPrec sp sl n (ListT x) = fst (show1Methods sp sl) n x@@ -51,15 +54,15 @@     showsPrec = liftShowsPrec showsPrec showList     showList = liftShowList showsPrec showList -instance Monad m => Applicative (ListT m) where-    pure x = ListT . pure . Just $ (x, ListT (pure Nothing))-    (<*>) = ap+instance Applicative p => Applicative (ListT p) where+    pure x = ListT . pure $ Just (x, ListT (pure Nothing))+    ListT xm <*> ListT ym = ListT ((liftA2 . liftA2) go xm ym)+      where go (x, xs) (y, ys) = (x y, x <$> ys <|> xs <*> ListT ym) -instance Monad m => Alternative (ListT m) where+instance Applicative p => Alternative (ListT p) where     empty = (ListT . pure) Nothing-    ListT xm <|> ys = ListT $ xm >>= \ case-        Nothing -> runListT ys-        Just (x, xs) -> (pure . Just) (x, xs <|> ys)+    ListT xm <|> ys = ListT ((fmap . fmap) go xm)+      where go (x, xs) = (x, xs <|> ys)  instance Monad m => Monad (ListT m) where     xm >>= f = join (f <$> xm)@@ -69,7 +72,10 @@                     Nothing -> runListT (join xss)                     Just (y, ys) -> (pure . Just) (y, ys <|> join xss) -instance Monad m => MonadPlus (ListT m)+instance Monad m => MonadPlus (ListT m) where+    ListT xm `mplus` ys = ListT $ xm >>= \ case+        Nothing -> runListT ys+        Just (x, xs) -> (pure . Just) (x, xs `mplus` ys)  instance MonadFix m => MonadFix (ListT m) where     mfix f = ListT $ (flip fmap . mfix) (runListT . f . fst . fromJust) . fmap $
ListT.cabal view
@@ -1,5 +1,5 @@ name:                ListT-version:             0.1.0.0+version:             0.1.1.0 synopsis:            List transformer -- description:          license:             BSD3