From 9310c687069743f47c538b29dfdb8bda4b396490 Mon Sep 17 00:00:00 2001 From: Richard Eisenberg Date: Thu, 13 Mar 2014 16:06:59 -0400 Subject: [PATCH] Add role annotations to Map and Set. See thread beginning here: http://www.haskell.org/pipermail/libraries/2014-March/022321.html --- 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 -- -- 1.8.3.2