[commit: vector] simd: Improve length and null (1a5a602)

Geoffrey Mainland gmainlan at ghc.haskell.org
Fri Jul 19 14:24:01 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : simd

http://hackage.haskell.org/trac/ghc/changeset/1a5a6029f995ac9567726f43d8d8bee706a69d5f

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

commit 1a5a6029f995ac9567726f43d8d8bee706a69d5f
Author: Roman Leshchinskiy <rl at cse.unsw.edu.au>
Date:   Sun Jan 29 11:03:08 2012 +0000

    Improve length and null

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

 Data/Vector/Fusion/Stream.hs         |    4 ++--
 Data/Vector/Fusion/Stream/Monadic.hs |    6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Data/Vector/Fusion/Stream.hs b/Data/Vector/Fusion/Stream.hs
index 9f4c80c..c872b5d 100644
--- a/Data/Vector/Fusion/Stream.hs
+++ b/Data/Vector/Fusion/Stream.hs
@@ -142,12 +142,12 @@ sized = M.sized
 -- ------
 
 -- | Length of a 'Stream'
-length :: Vector v a => Stream v a -> Int
+length :: Stream v a -> Int
 {-# INLINE length #-}
 length = unId . M.length
 
 -- | Check if a 'Stream' is empty
-null :: Vector v a => Stream v a -> Bool
+null :: Stream v a -> Bool
 {-# INLINE null #-}
 null = unId . M.null
 
diff --git a/Data/Vector/Fusion/Stream/Monadic.hs b/Data/Vector/Fusion/Stream/Monadic.hs
index 857fd03..df69003 100644
--- a/Data/Vector/Fusion/Stream/Monadic.hs
+++ b/Data/Vector/Fusion/Stream/Monadic.hs
@@ -169,16 +169,14 @@ sized s sz = s { sSize = sz }
 -- ------
 
 -- | Length of a 'Stream'
-length :: (Monad m, Vector v a) => Stream m v a -> m Int
+length :: Monad m => Stream m v a -> m Int
 {-# INLINE_STREAM length #-}
-length Stream{sVector = Just v} = return (basicLength v)
 length Stream{sSize = Exact n}  = return n
 length s = vfoldl' (\n (Chunk k _) -> n+k) 0 s
 
 -- | Check if a 'Stream' is empty
-null :: (Monad m, Vector v a) => Stream m v a -> m Bool
+null :: Monad m => Stream m v a -> m Bool
 {-# INLINE_STREAM null #-}
-null Stream{sVector = Just v} = return (basicLength v == 0)
 null Stream{sSize = Exact n} = return (n == 0)
 null Stream{sChunks = Unf step s} = null_loop s
   where






More information about the ghc-commits mailing list