From 55fc4ce2b2795366ed118c84e6671e4e73b3ea89 Mon Sep 17 00:00:00 2001 From: Roman Leshchinskiy Date: Wed, 5 Dec 2007 22:08:59 +0000 Subject: [PATCH] Add singletonP to GHC.PArr --- GHC/PArr.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GHC/PArr.hs b/GHC/PArr.hs index cd2f03b..1299f3e 100644 --- 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 + 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 -- 1.7.10.4