[project @ 2005-09-01 10:49:07 by ross]
authorross <unknown>
Thu, 1 Sep 2005 10:49:07 +0000 (10:49 +0000)
committerross <unknown>
Thu, 1 Sep 2005 10:49:07 +0000 (10:49 +0000)
GHC only: define toList using build

Data/Sequence.hs

index 4ee0883..bc3a743 100644 (file)
@@ -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