@@ -6,6 +6,7 @@
66{-# LANGUAGE GeneralizedNewtypeDeriving #-}
77{-# LANGUAGE DeriveTraversable #-}
88{-# LANGUAGE DeriveDataTypeable #-}
9+{-# LANGUAGE StandaloneDeriving #-}
910
1011-- | This module provides a 'Data.Map' variant which uses the value's
1112-- 'Monoid' instance to accumulate conflicting entries when merging
@@ -144,13 +145,24 @@ import Control.DeepSeq
144145import qualified Data.Map as M
145146import Control.Lens
146147import Control.Newtype
148+import Data.Aeson(FromJSON, ToJSON, FromJSON1, ToJSON1)
149+#if MIN_VERSION_containers(0,5,9)
150+import Data.Functor.Classes
151+#endif
147152
148153-- | A 'Map' with monoidal accumulation
149154newtype MonoidalMap k a = MonoidalMap { getMonoidalMap :: M.Map k a }
150155 deriving (Show, Read, Functor, Eq, Ord, NFData,
151156 Foldable, Traversable,
157+ FromJSON, ToJSON, FromJSON1, ToJSON1,
152158 Data, Typeable)
153159
160+#if MIN_VERSION_containers(0,5,9)
161+deriving instance (Ord k) => Eq1 (MonoidalMap k)
162+deriving instance (Ord k) => Ord1 (MonoidalMap k)
163+deriving instance (Show k) => Show1 (MonoidalMap k)
164+#endif
165+
154166type instance Index (MonoidalMap k a) = k
155167type instance IxValue (MonoidalMap k a) = a
156168instance Ord k => Ixed (MonoidalMap k a) where