git.iko.soy/typeable/ordered-containers
on master help sign in
Merge pull request #14 from RyanGlScott/bias-instances

Define "pass-through" instances for Bias

commit73f8217aae127f9b9e1553344bc25b2c630912e6 authorDaniel Wagner <me@dmwit.com> dateMon 25 Mar 2019, 17:10 (8 years ago) parentd4fd56e68a87bf
1 file changed+13
Data/Map/Util.hs+13
Data/Map/Util.hs+13
@@ -1,12 +1,23 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
3+{-# LANGUAGE DeriveDataTypeable #-}
4+{-# LANGUAGE DeriveFoldable #-}
5+{-# LANGUAGE DeriveFunctor #-}
6+{-# LANGUAGE DeriveTraversable #-}
27{-# LANGUAGE KindSignatures #-}
38
49module Data.Map.Util where
510
11+import Data.Data (Data, Typeable)
612import Data.Map (Map)
713import Data.Monoid -- so that the docs for Monoid link to the right place
814import qualified Data.Map as M
915
16+#if !(MIN_VERSION_base(4,8,0))
17+import Data.Foldable (Foldable)
18+import Data.Traversable (Traversable)
19+#endif
20+
1021-- | An internal index used to track ordering only -- its magnitude doesn't
1122-- matter. If you manage to see this documentation, the library author has made
1223-- a mistake!
@@ -38,6 +49,8 @@ readsPrecList fromList d = readParen (d > 10) $ \r -> do
3849-- tells whether 'mappend' will prefer the indices of its first or second
3950-- argument if there are shared elements in both.
4051newtype Bias (dir :: IndexPreference) a = Bias { unbiased :: a }
52+ deriving (Data, Eq, Foldable, Functor, Ord, Read, Show, Traversable, Typeable)
4153data IndexPreference = L | R
54+ deriving Typeable
4255type L = 'L
4356type R = 'R