@@ -1,8 +1,5 @@
1−{-# LANGUAGE CPP #-}
1+{-# LANGUAGE DeriveDataTypeable #-}
22{-# LANGUAGE DeriveFunctor #-}
3−#if __GLASGOW_HASKELL__
4−{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
5−#endif
63
74-- | An 'OMap' behaves much like a 'Map', with all the same asymptotics, but
85-- also remembers the order that keys were inserted.
@@ -33,6 +30,7 @@ module Data.Map.Ordered
3330
3431import Control.Applicative ((<|>))
3532import Control.Monad (guard)
33+import Data.Data
3634import Data.Foldable (Foldable, foldl', foldMap)
3735import Data.Function (on)
3836import Data.Map (Map)
@@ -40,11 +38,8 @@ import Data.Map.Util (Index, Tag, maxTag, minTag, nextHigherTag, nextLowerTag, r
4038import Prelude hiding (filter, lookup, null)
4139import qualified Data.Map as M
4240
43−#if __GLASGOW_HASKELL__
44−import Data.Data
45−#endif
46−
47−data OMap k v = OMap !(Map k (Tag, v)) !(Map Tag (k, v)) deriving Functor
41+data OMap k v = OMap !(Map k (Tag, v)) !(Map Tag (k, v))
42+ deriving (Functor, Typeable)
4843
4944-- | Values are produced in insertion order, not key order.
5045instance Foldable (OMap k) where foldMap f (OMap _ kvs) = foldMap (f . snd) kvs
@@ -53,13 +48,6 @@ instance ( Ord k, Ord v) => Ord (OMap k v) where compare = compare `on`
5348instance ( Show k, Show v) => Show (OMap k v) where showsPrec = showsPrecList assocs
5449instance (Ord k, Read k, Read v) => Read (OMap k v) where readsPrec = readsPrecList fromList
5550
56−#if __GLASGOW_HASKELL__
57−# if __GLASGOW_HASKELL__ >= 708
58−deriving instance Typeable OMap
59−# else
60−deriving instance Typeable2 OMap
61−# endif
62−
6351-- This instance preserves data abstraction at the cost of inefficiency.
6452-- We provide limited reflection services for the sake of data abstraction.
6553
@@ -77,7 +65,6 @@ fromListConstr = mkConstr oMapDataType "fromList" [] Prefix
7765
7866oMapDataType :: DataType
7967oMapDataType = mkDataType "Data.Map.Ordered.Map" [fromListConstr]
80−#endif
8168
8269infixr 5 <|, |< -- copy :
8370infixl 5 >|, |>