@@ -1,12 +1,23 @@
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
3+{-# LANGUAGE DeriveDataTypeable #-}
4+{-# LANGUAGE DeriveFoldable #-}
5+{-# LANGUAGE DeriveFunctor #-}
6+{-# LANGUAGE DeriveTraversable #-}
2{-# LANGUAGE KindSignatures #-}
7{-# LANGUAGE KindSignatures #-}
4module Data.Map.Util where
9module Data.Map.Util where
11+import Data.Data (Data, Typeable)
6import Data.Map (Map)
12import Data.Map (Map)
7import Data.Monoid -- so that the docs for Monoid link to the right place
13import Data.Monoid -- so that the docs for Monoid link to the right place
8import qualified Data.Map as M
14import qualified Data.Map as M
16+#if !(MIN_VERSION_base(4,8,0))
17+import Data.Foldable (Foldable)
18+import Data.Traversable (Traversable)
10-- | An internal index used to track ordering only -- its magnitude doesn't
21-- | An internal index used to track ordering only -- its magnitude doesn't
11-- matter. If you manage to see this documentation, the library author has made
22-- matter. If you manage to see this documentation, the library author has made
12-- a mistake!
23-- a mistake!
@@ -38,6 +49,8 @@ readsPrecList fromList d = readParen (d > 10) $ \r -> do
38-- tells whether 'mappend' will prefer the indices of its first or second
49-- tells whether 'mappend' will prefer the indices of its first or second
39-- argument if there are shared elements in both.
50-- argument if there are shared elements in both.
40newtype Bias (dir :: IndexPreference) a = Bias { unbiased :: a }
51newtype Bias (dir :: IndexPreference) a = Bias { unbiased :: a }
52+ deriving (Data, Eq, Foldable, Functor, Ord, Read, Show, Traversable, Typeable)
41data IndexPreference = L | R
53data IndexPreference = L | R
42type L = 'L
55type L = 'L
43type R = 'R
56type R = 'R