[commit: packages/containers] master: Add COMPLETE pragmas for Data.Sequence (f42e932)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:49:02 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branch  : master
Link       : http://git.haskell.org/packages/containers.git/commitdiff/f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a

>---------------------------------------------------------------

commit f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a
Author: David Feuer <David.Feuer at gmail.com>
Date:   Tue Feb 28 21:52:36 2017 -0500

    Add COMPLETE pragmas for Data.Sequence
    
    GHC 8.2 allows us to declare sets of pattern synonyms complete.
    We happily do so!


>---------------------------------------------------------------

f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a
 Data/Sequence/Internal.hs | 7 ++++---
 changelog.md              | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs
index 71279a8..9879321 100644
--- a/Data/Sequence/Internal.hs
+++ b/Data/Sequence/Internal.hs
@@ -286,9 +286,10 @@ infixl 5 |>, :>
 infixr 5 :<|
 infixl 5 :|>
 
--- TODO: Once GHC implements some way to prevent non-exhaustive
--- pattern match warnings for pattern synonyms, we should be
--- sure to take advantage of that.
+#if __GLASGOW_HASKELL__ >= 801
+{-# COMPLETE (:<|), Empty #-}
+{-# COMPLETE (:|>), Empty #-}
+#endif
 
 -- | A pattern synonym matching an empty sequence.
 pattern Empty :: Seq a
diff --git a/changelog.md b/changelog.md
index 8ee717e..418406a 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,6 +4,9 @@
 
 * Planned for GHC 8.2.
 
+* Use `COMPLETE` pragmas to declare complete sets of pattern synonyms
+  for `Data.Sequence`. At last!
+
 * Make `Data.IntMap.Strict.traverseWithKey` force the values before
   installing them in the result. Previously, this function could be used to
   produce an `IntMap` containing undefined values.



More information about the ghc-commits mailing list