From: Roman Leshchinskiy Date: Wed, 5 Dec 2007 22:08:59 +0000 (+0000) Subject: Add singletonP to GHC.PArr X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=55fc4ce2b2795366ed118c84e6671e4e73b3ea89;p=ghc-base.git Add singletonP to GHC.PArr --- 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