list-t 0.3.3 → 0.4.0
raw patch · 3 files changed
+8/−34 lines, 3 filesdep ~mmorphdep ~monad-control
Dependency ranges changed: mmorph, monad-control
Files
- library/ListT.hs +6/−12
- list-t.cabal +2/−3
- tests/Main.hs +0/−19
library/ListT.hs view
@@ -36,13 +36,13 @@ ) where -import BasePrelude hiding (uncons, toList, yield, fold, traverse, head, tail, take, drop, repeat, null, traverse_, splitAt)+import BasePrelude hiding (toList, yield, fold, traverse, head, tail, take, drop, repeat, null, traverse_, splitAt) import Control.Monad.Morph hiding (MonadTrans(..)) import Control.Monad.IO.Class import Control.Monad.Trans.Class import Control.Monad.Trans.Reader import Control.Monad.Trans.Maybe-import Control.Monad.Trans.Control hiding (embed, embed_)+import Control.Monad.Trans.Control import Control.Monad.Base -- |@@ -115,23 +115,17 @@ hoist f (ListT m) = ListT $ f $ m >>= return . fmap (\(h, t) -> (h, hoist f t)) -instance MMonad ListT where- embed f (ListT m) =- f m >>= \case- Nothing -> mzero- Just (h, t) -> ListT $ return $ Just $ (h, embed f t)- instance MonadBase b m => MonadBase b (ListT m) where liftBase = lift . liftBase instance MonadBaseControl b m => MonadBaseControl b (ListT m) where- newtype StM (ListT m) a =- StM (StM m (Maybe (a, ListT m a)))+ type StM (ListT m) a =+ StM m (Maybe (a, ListT m a)) liftBaseWith runToBase = lift $ liftBaseWith $ \runInner -> - runToBase $ liftM StM . runInner . uncons- restoreM (StM inner) =+ runToBase $ runInner . uncons+ restoreM inner = lift (restoreM inner) >>= \case Nothing -> mzero Just (h, t) -> cons h t
list-t.cabal view
@@ -1,7 +1,7 @@ name: list-t version:- 0.3.3+ 0.4.0 synopsis: ListT done right description:@@ -44,7 +44,7 @@ ListT build-depends: mmorph == 1.0.*,- monad-control == 0.3.*,+ monad-control == 1.0.*, transformers-base == 0.4.*, transformers >= 0.2 && < 0.5, base-prelude == 0.1.*@@ -63,7 +63,6 @@ Main.hs build-depends: list-t,- mmorph, HTF == 0.12.*, mtl-prelude < 3, base-prelude >= 0.1.3 && < 0.2
tests/Main.hs view
@@ -2,30 +2,11 @@ import BasePrelude hiding (toList) import MTLPrelude-import Control.Monad.Morph import Test.Framework import qualified ListT as L main = htfMain $ htf_thisModulesTests----- * MMonad------------------------------ embed lift = id-prop_mmonadLaw1 (l :: [Int]) =- let s = L.fromFoldable l- in runIdentity $ streamsEqual s (embed lift s)---- embed f (lift m) = f m-prop_mmonadLaw2 l =- let s = (L.fromFoldable :: [Int] -> L.ListT Identity Int) l- f = MaybeT . fmap Just- run = runIdentity . L.toList . runMaybeT- in - run (f s) == - run (embed f (lift s)) -- * Applicative