From ebc073c8f912ef7be20ec5d9fa22dc7ddc0b53e2 Mon Sep 17 00:00:00 2001 From: ross Date: Thu, 1 Sep 2005 10:49:07 +0000 Subject: [PATCH] [project @ 2005-09-01 10:49:07 by ross] GHC only: define toList using build --- Data/Sequence.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 4ee0883..bc3a743 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -cpp #-} +{-# OPTIONS -cpp -fglasgow-exts #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Sequence @@ -83,6 +83,9 @@ import qualified Prelude (foldr) import qualified Data.List (foldl', intersperse) import Data.FunctorM import Data.Typeable +#ifdef __GLASGOW_HASKELL__ +import GHC.Exts (build) +#endif #if TESTING import Control.Monad (liftM, liftM2, liftM3, liftM4) @@ -881,7 +884,12 @@ fromList = Data.List.foldl' (|>) empty -- | /O(n)/. List of elements of the sequence. toList :: Seq a -> [a] +#ifdef __GLASGOW_HASKELL__ +{-# INLINE toList #-} +toList xs = build (\ c n -> foldr c n xs) +#else toList = foldr (:) [] +#endif ------------------------------------------------------------------------ -- Folds -- 1.7.10.4