Add singletonP to GHC.PArr
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Wed, 5 Dec 2007 22:08:59 +0000 (22:08 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Wed, 5 Dec 2007 22:08:59 +0000 (22:08 +0000)
GHC/PArr.hs

index cd2f03b..1299f3e 100644 (file)
@@ -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
+  singletonP,           -- :: 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
 
+singletonP             :: a -> [:a:]
+{-# INLINE singletonP #-}
+singletonP e = replicateP 1 e
+
 replicateP             :: Int -> a -> [:a:]
 {-# INLINE replicateP #-}
 replicateP n e  = runST (do