projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e5b9b2f
)
Add singletonP to GHC.PArr
author
Roman Leshchinskiy
<rl@cse.unsw.edu.au>
Wed, 5 Dec 2007 22:08:59 +0000
(22:08 +0000)
committer
Roman Leshchinskiy
<rl@cse.unsw.edu.au>
Wed, 5 Dec 2007 22:08:59 +0000
(22:08 +0000)
GHC/PArr.hs
patch
|
blob
|
history
diff --git
a/GHC/PArr.hs
b/GHC/PArr.hs
index
cd2f03b
..
1299f3e
100644
(file)
--- a/
GHC/PArr.hs
+++ b/
GHC/PArr.hs
@@
-92,6
+92,7
@@
module GHC.PArr (
scanrP, -- :: (a -> b -> b) -> b -> [:a:] -> [:b:]
scanr1P, -- :: (a -> a -> a) -> [:a:] -> [:a:]
-- iterate, repeat, -- parallel arrays must be finite
scanrP, -- :: (a -> b -> b) -> b -> [:a:] -> [:b:]
scanr1P, -- :: (a -> a -> a) -> [:a:] -> [:a:]
-- iterate, repeat, -- parallel arrays must be finite
+ singletonP, -- :: a -> [:a:]
replicateP, -- :: Int -> a -> [:a:]
-- cycle, -- parallel arrays must be finite
takeP, -- :: Int -> [:a:] -> [:a:]
replicateP, -- :: Int -> a -> [:a:]
-- cycle, -- parallel arrays must be finite
takeP, -- :: Int -> [:a:] -> [:a:]
@@
-236,6
+237,10
@@
scanr1P = error "Prelude.scanr1P: not implemented yet" -- FIXME
-- iterate, repeat -- parallel arrays must be finite
-- iterate, repeat -- parallel arrays must be finite
+singletonP :: a -> [:a:]
+{-# INLINE singletonP #-}
+singletonP e = replicateP 1 e
+
replicateP :: Int -> a -> [:a:]
{-# INLINE replicateP #-}
replicateP n e = runST (do
replicateP :: Int -> a -> [:a:]
{-# INLINE replicateP #-}
replicateP n e = runST (do