[commit: packages/vector] ghc-head: liftStream -> lift (19d0dd4)

git at git.haskell.org git at git.haskell.org
Thu Sep 26 11:54:10 CEST 2013


Repository : ssh://git@git.haskell.org/vector

On branch  : ghc-head
Link       : http://git.haskell.org/packages/vector.git/commitdiff/19d0dd4451d54cb3f686d2aecc91bf93aca9b5e4

>---------------------------------------------------------------

commit 19d0dd4451d54cb3f686d2aecc91bf93aca9b5e4
Author: Roman Leshchinskiy <rl at cse.unsw.edu.au>
Date:   Tue Jan 31 23:41:33 2012 +0000

    liftStream -> lift


>---------------------------------------------------------------

19d0dd4451d54cb3f686d2aecc91bf93aca9b5e4
 Data/Vector/Fusion/Stream.hs   |   28 ++++++++++++++--------------
 Data/Vector/Generic.hs         |   14 +++++++-------
 Data/Vector/Generic/Mutable.hs |    6 +++---
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/Data/Vector/Fusion/Stream.hs b/Data/Vector/Fusion/Stream.hs
index 66ed00d..a49a8d6 100644
--- a/Data/Vector/Fusion/Stream.hs
+++ b/Data/Vector/Fusion/Stream.hs
@@ -67,7 +67,7 @@ module Data.Vector.Fusion.Stream (
   enumFromStepN, enumFromTo, enumFromThenTo,
 
   -- * Conversions
-  toList, fromList, fromListN, unsafeFromList, liftStream,
+  toList, fromList, fromListN, unsafeFromList, lift,
   fromVector, reVector, fromVectors, concatVectors,
 
   -- * Monadic combinators
@@ -122,9 +122,9 @@ inplace f s = s `seq` f s
   #-}
 
 -- | Convert a pure stream to a monadic stream
-liftStream :: Monad m => Facets v a -> M.Facets m v a
-{-# INLINE_FUSED liftStream #-}
-liftStream (M.Facets (M.Unf step s) (M.Unf vstep t) v sz)
+lift :: Monad m => Facets v a -> M.Facets m v a
+{-# INLINE_FUSED lift #-}
+lift (M.Facets (M.Unf step s) (M.Unf vstep t) v sz)
     = M.Facets (M.Unf (return . unId . step) s)
                (M.Unf (return . unId . vstep) t) v sz
 
@@ -506,45 +506,45 @@ instance Ord a => Ord (M.Facets Id v a) where
 -- stream of results
 mapM :: Monad m => (a -> m b) -> Facets v a -> M.Facets m v b
 {-# INLINE mapM #-}
-mapM f = M.mapM f . liftStream
+mapM f = M.mapM f . lift
 
 -- | Apply a monadic action to each element of the stream
 mapM_ :: Monad m => (a -> m b) -> Facets v a -> m ()
 {-# INLINE mapM_ #-}
-mapM_ f = M.mapM_ f . liftStream
+mapM_ f = M.mapM_ f . lift
 
 zipWithM :: Monad m => (a -> b -> m c) -> Facets v a -> Facets v b -> M.Facets m v c
 {-# INLINE zipWithM #-}
-zipWithM f as bs = M.zipWithM f (liftStream as) (liftStream bs)
+zipWithM f as bs = M.zipWithM f (lift as) (lift bs)
 
 zipWithM_ :: Monad m => (a -> b -> m c) -> Facets v a -> Facets v b -> m ()
 {-# INLINE zipWithM_ #-}
-zipWithM_ f as bs = M.zipWithM_ f (liftStream as) (liftStream bs)
+zipWithM_ f as bs = M.zipWithM_ f (lift as) (lift bs)
 
 -- | Yield a monadic stream of elements that satisfy the monadic predicate
 filterM :: Monad m => (a -> m Bool) -> Facets v a -> M.Facets m v a
 {-# INLINE filterM #-}
-filterM f = M.filterM f . liftStream
+filterM f = M.filterM f . lift
 
 -- | Monadic fold
 foldM :: Monad m => (a -> b -> m a) -> a -> Facets v b -> m a
 {-# INLINE foldM #-}
-foldM m z = M.foldM m z . liftStream
+foldM m z = M.foldM m z . lift
 
 -- | Monadic fold over non-empty stream
 fold1M :: Monad m => (a -> a -> m a) -> Facets v a -> m a
 {-# INLINE fold1M #-}
-fold1M m = M.fold1M m . liftStream
+fold1M m = M.fold1M m . lift
 
 -- | Monadic fold with strict accumulator
 foldM' :: Monad m => (a -> b -> m a) -> a -> Facets v b -> m a
 {-# INLINE foldM' #-}
-foldM' m z = M.foldM' m z . liftStream
+foldM' m z = M.foldM' m z . lift
 
 -- | Monad fold over non-empty stream with strict accumulator
 fold1M' :: Monad m => (a -> a -> m a) -> Facets v a -> m a
 {-# INLINE fold1M' #-}
-fold1M' m = M.fold1M' m . liftStream
+fold1M' m = M.fold1M' m . lift
 
 -- Enumerations
 -- ------------
@@ -625,5 +625,5 @@ concatVectors = M.concatVectors
 -- | Create a 'Facets' of values from a 'Facets' of streamable things
 flatten :: (a -> s) -> (s -> Step s b) -> Size -> Facets v a -> Facets v b
 {-# INLINE_FUSED flatten #-}
-flatten mk istep sz = M.flatten (return . mk) (return . istep) sz . liftStream
+flatten mk istep sz = M.flatten (return . mk) (return . istep) sz . lift
 
diff --git a/Data/Vector/Generic.hs b/Data/Vector/Generic.hs
index ed94442..013ea93 100644
--- a/Data/Vector/Generic.hs
+++ b/Data/Vector/Generic.hs
@@ -169,7 +169,7 @@ import qualified Data.Vector.Generic.New as New
 import           Data.Vector.Generic.New ( New )
 
 import qualified Data.Vector.Fusion.Stream as Stream
-import           Data.Vector.Fusion.Stream ( Facets, MFacets, Step(..), inplace, liftStream )
+import           Data.Vector.Fusion.Stream ( Facets, MFacets, Step(..), inplace, lift )
 import qualified Data.Vector.Fusion.Stream.Monadic as MStream
 import           Data.Vector.Fusion.Stream.Size
 import           Data.Vector.Fusion.Util
@@ -349,22 +349,22 @@ unsafeLastM v = unsafeIndexM v (length v - 1)
 {-# RULES
 
 "indexM/unstream [Vector]" forall s i.
-  indexM (new (New.unstream s)) i = liftStream s MStream.!! i
+  indexM (new (New.unstream s)) i = lift s MStream.!! i
 
 "headM/unstream [Vector]" forall s.
-  headM (new (New.unstream s)) = MStream.head (liftStream s)
+  headM (new (New.unstream s)) = MStream.head (lift s)
 
 "lastM/unstream [Vector]" forall s.
-  lastM (new (New.unstream s)) = MStream.last (liftStream s)
+  lastM (new (New.unstream s)) = MStream.last (lift s)
 
 "unsafeIndexM/unstream [Vector]" forall s i.
-  unsafeIndexM (new (New.unstream s)) i = liftStream s MStream.!! i
+  unsafeIndexM (new (New.unstream s)) i = lift s MStream.!! i
 
 "unsafeHeadM/unstream [Vector]" forall s.
-  unsafeHeadM (new (New.unstream s)) = MStream.head (liftStream s)
+  unsafeHeadM (new (New.unstream s)) = MStream.head (lift s)
 
 "unsafeLastM/unstream [Vector]" forall s.
-  unsafeLastM (new (New.unstream s)) = MStream.last (liftStream s)
+  unsafeLastM (new (New.unstream s)) = MStream.last (lift s)
 
   #-}
 
diff --git a/Data/Vector/Generic/Mutable.hs b/Data/Vector/Generic/Mutable.hs
index 496baef..becf594 100644
--- a/Data/Vector/Generic/Mutable.hs
+++ b/Data/Vector/Generic/Mutable.hs
@@ -318,7 +318,7 @@ unstream :: (PrimMonad m, MVector v a)
          => Facets u a -> m (v (PrimState m) a)
 -- NOTE: replace INLINE_FUSED by INLINE? (also in unstreamR)
 {-# INLINE_FUSED unstream #-}
-unstream s = munstream (Stream.liftStream s)
+unstream s = munstream (Stream.lift s)
 
 -- | Create a new mutable vector and fill it with elements from the monadic
 -- stream. The vector will grow exponentially if the maximum size of the stream
@@ -383,7 +383,7 @@ vunstream :: (PrimMonad m, V.Vector v a)
          => Facets v a -> m (V.Mutable v (PrimState m) a)
 -- NOTE: replace INLINE_FUSED by INLINE? (also in unstreamR)
 {-# INLINE_FUSED vunstream #-}
-vunstream s = vmunstream (Stream.liftStream s)
+vunstream s = vmunstream (Stream.lift s)
 
 -- | Create a new mutable vector and fill it with elements from the monadic
 -- stream. The vector will grow exponentially if the maximum size of the stream
@@ -451,7 +451,7 @@ unstreamR :: (PrimMonad m, MVector v a)
           => Facets u a -> m (v (PrimState m) a)
 -- NOTE: replace INLINE_FUSED by INLINE? (also in unstream)
 {-# INLINE_FUSED unstreamR #-}
-unstreamR s = munstreamR (Stream.liftStream s)
+unstreamR s = munstreamR (Stream.lift s)
 
 -- | Create a new mutable vector and fill it with elements from the monadic
 -- stream from right to left. The vector will grow exponentially if the maximum




More information about the ghc-commits mailing list