[commit: packages/containers] ghc-head: Add role annotations to Map and Set. (c243512)

git at git.haskell.org git at git.haskell.org
Thu Mar 13 21:07:11 UTC 2014


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

On branch  : ghc-head
Link       : http://git.haskell.org/packages/containers.git/commitdiff/c24351257bf22627226a3fb94c140353fd611197

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

commit c24351257bf22627226a3fb94c140353fd611197
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Thu Mar 13 16:06:59 2014 -0400

    Add role annotations to Map and Set.
    
    See thread beginning here:
    http://www.haskell.org/pipermail/libraries/2014-March/022321.html


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

c24351257bf22627226a3fb94c140353fd611197
 Data/Map/Base.hs |    4 ++++
 Data/Set/Base.hs |    4 ++++
 containers.cabal |    2 ++
 3 files changed, 10 insertions(+)

diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs
index 1f6512f..6a93a73 100644
--- a/Data/Map/Base.hs
+++ b/Data/Map/Base.hs
@@ -327,6 +327,10 @@ data Map k a  = Bin {-# UNPACK #-} !Size !k a !(Map k a) !(Map k a)
 
 type Size     = Int
 
+#if __GLASGOW_HASKELL__ >= 708
+type role Map nominal representational
+#endif
+
 instance (Ord k) => Monoid (Map k v) where
     mempty  = empty
     mappend = union
diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs
index 675c966..720ffb5 100644
--- a/Data/Set/Base.hs
+++ b/Data/Set/Base.hs
@@ -229,6 +229,10 @@ data Set a    = Bin {-# UNPACK #-} !Size !a !(Set a) !(Set a)
 
 type Size     = Int
 
+#if __GLASGOW_HASKELL >= 708
+type role Set nominal
+#endif
+
 instance Ord a => Monoid (Set a) where
     mempty  = empty
     mappend = union
diff --git a/containers.cabal b/containers.cabal
index b67548c..90bfa9c 100644
--- a/containers.cabal
+++ b/containers.cabal
@@ -63,6 +63,8 @@ Library
 
     if impl(ghc<7.0)
         extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types
+    if impl(ghc >= 7.8)
+        extensions: RoleAnnotations
 
 -------------------
 -- T E S T I N G --



More information about the ghc-commits mailing list