[commit: packages/containers] develop-0.6, develop-0.6-questionable, master, zip-devel: Add an IsList instance for Data.Sequence.Seq (1931ecf)
git at git.haskell.org
git at git.haskell.org
Sun Dec 20 16:21:57 UTC 2015
Repository : ssh://git@git.haskell.org/containers
On branches: develop-0.6,develop-0.6-questionable,master,zip-devel
Link : http://git.haskell.org/packages/containers.git/commitdiff/1931ecf7da3d4e4ead4bd1ef5f5ed07807893339
>---------------------------------------------------------------
commit 1931ecf7da3d4e4ead4bd1ef5f5ed07807893339
Author: David Feuer <David.Feuer at gmail.com>
Date: Wed Dec 3 17:16:39 2014 -0500
Add an IsList instance for Data.Sequence.Seq
>---------------------------------------------------------------
1931ecf7da3d4e4ead4bd1ef5f5ed07807893339
Data/Sequence.hs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Data/Sequence.hs b/Data/Sequence.hs
index 511cad9..757f677 100644
--- a/Data/Sequence.hs
+++ b/Data/Sequence.hs
@@ -5,6 +5,9 @@
#if __GLASGOW_HASKELL__ >= 703
{-# LANGUAGE Trustworthy #-}
#endif
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE TypeFamilies #-}
+#endif
-- We use cabal-generated MIN_VERSION_base to adapt to changes of base.
-- Nevertheless, as a convenience, we also allow compiling without cabal by
-- defining trivial MIN_VERSION_base if needed.
@@ -171,7 +174,9 @@ import Data.Coerce
#if MIN_VERSION_base(4,8,0)
import Data.Functor.Identity (Identity(..))
#endif
-
+#if __GLASGOW_HASKELL__ >= 708
+import qualified GHC.Exts
+#endif
infixr 5 `consTree`
infixl 5 `snocTree`
@@ -1655,6 +1660,13 @@ findIndicesR p xs = foldlWithIndex g [] xs
fromList :: [a] -> Seq a
fromList = Data.List.foldl' (|>) empty
+#if __GLASGOW_HASKELL__ >= 708
+instance GHC.Exts.IsList (Seq a) where
+ type Item (Seq a) = a
+ fromList = fromList
+ toList = toList
+#endif
+
------------------------------------------------------------------------
-- Reverse
------------------------------------------------------------------------
More information about the ghc-commits
mailing list