{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE KindSignatures #-}

module Data.Map.Util where

import Data.Data (Data, Typeable)
import Data.Map (Map)
import Data.Monoid -- so that the docs for Monoid link to the right place
import qualified Data.Map as M

#if !(MIN_VERSION_base(4,8,0))
import Data.Foldable (Foldable)
import Data.Traversable (Traversable)
#endif

-- | An internal index used to track ordering only -- its magnitude doesn't
-- matter. If you manage to see this documentation, the library author has made
-- a mistake!
type Tag = Int

-- | A 0-based index, much like the indices used by lists' '!!' operation. All
-- indices are with respect to insertion order.
type Index = Int

nextLowerTag, nextHigherTag :: Map Tag a -> Tag
nextLowerTag :: forall a. Map Tag a -> Tag
nextLowerTag  = Tag -> (Tag -> Tag) -> Maybe Tag -> Tag
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Tag
0 Tag -> Tag
forall a. Enum a => a -> a
pred (Maybe Tag -> Tag) -> (Map Tag a -> Maybe Tag) -> Map Tag a -> Tag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map Tag a -> Maybe Tag
forall a. Map Tag a -> Maybe Tag
minTag
nextHigherTag :: forall a. Map Tag a -> Tag
nextHigherTag = Tag -> (Tag -> Tag) -> Maybe Tag -> Tag
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Tag
0 Tag -> Tag
forall a. Enum a => a -> a
succ (Maybe Tag -> Tag) -> (Map Tag a -> Maybe Tag) -> Map Tag a -> Tag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map Tag a -> Maybe Tag
forall a. Map Tag a -> Maybe Tag
maxTag

minTag, maxTag :: Map Tag a -> Maybe Tag
minTag :: forall a. Map Tag a -> Maybe Tag
minTag Map Tag a
m = (((Tag, a), Map Tag a) -> Tag)
-> Maybe ((Tag, a), Map Tag a) -> Maybe Tag
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Tag, a) -> Tag
forall a b. (a, b) -> a
fst ((Tag, a) -> Tag)
-> (((Tag, a), Map Tag a) -> (Tag, a))
-> ((Tag, a), Map Tag a)
-> Tag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Tag, a), Map Tag a) -> (Tag, a)
forall a b. (a, b) -> a
fst) (Map Tag a -> Maybe ((Tag, a), Map Tag a)
forall k a. Map k a -> Maybe ((k, a), Map k a)
M.minViewWithKey Map Tag a
m)
maxTag :: forall a. Map Tag a -> Maybe Tag
maxTag Map Tag a
m = (((Tag, a), Map Tag a) -> Tag)
-> Maybe ((Tag, a), Map Tag a) -> Maybe Tag
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Tag, a) -> Tag
forall a b. (a, b) -> a
fst ((Tag, a) -> Tag)
-> (((Tag, a), Map Tag a) -> (Tag, a))
-> ((Tag, a), Map Tag a)
-> Tag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Tag, a), Map Tag a) -> (Tag, a)
forall a b. (a, b) -> a
fst) (Map Tag a -> Maybe ((Tag, a), Map Tag a)
forall k a. Map k a -> Maybe ((k, a), Map k a)
M.maxViewWithKey Map Tag a
m)

showsPrecList :: Show a => (b -> [a]) -> Int -> b -> ShowS
showsPrecList :: forall a b. Show a => (b -> [a]) -> Tag -> b -> ShowS
showsPrecList b -> [a]
toList Tag
d b
o = Bool -> ShowS -> ShowS
showParen (Tag
d Tag -> Tag -> Bool
forall a. Ord a => a -> a -> Bool
> Tag
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
	String -> ShowS
showString String
"fromList " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> ShowS
forall a. Show a => a -> ShowS
shows (b -> [a]
toList b
o)

readsPrecList :: Read a => ([a] -> b) -> Int -> ReadS b
readsPrecList :: forall a b. Read a => ([a] -> b) -> Tag -> ReadS b
readsPrecList [a] -> b
fromList Tag
d = Bool -> ReadS b -> ReadS b
forall a. Bool -> ReadS a -> ReadS a
readParen (Tag
d Tag -> Tag -> Bool
forall a. Ord a => a -> a -> Bool
> Tag
10) (ReadS b -> ReadS b) -> ReadS b -> ReadS b
forall a b. (a -> b) -> a -> b
$ \String
r -> do
	(String
"fromList", String
s) <- ReadS String
lex String
r
	([a]
xs, String
t) <- ReadS [a]
forall a. Read a => ReadS a
reads String
s
	(b, String) -> [(b, String)]
forall a. a -> [a]
forall (m :: * -> *) a. Monad m => a -> m a
return ([a] -> b
fromList [a]
xs, String
t)

-- | A newtype to hang a 'Monoid' instance on. The phantom first parameter
-- tells whether 'mappend' will prefer the indices of its first or second
-- argument if there are shared elements in both.
--
-- @since 0.2
newtype Bias (dir :: IndexPreference) a = Bias { forall (dir :: IndexPreference) a. Bias dir a -> a
unbiased :: a }
	deriving (Typeable (Bias dir a)
Typeable (Bias dir a) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Bias dir a))
-> (Bias dir a -> Constr)
-> (Bias dir a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Bias dir a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Bias dir a)))
-> ((forall b. Data b => b -> b) -> Bias dir a -> Bias dir a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Bias dir a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Bias dir a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Bias dir a -> [u])
-> (forall u.
    Tag -> (forall d. Data d => d -> u) -> Bias dir a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a))
-> Data (Bias dir a)
Bias dir a -> Constr
Bias dir a -> DataType
(forall b. Data b => b -> b) -> Bias dir a -> Bias dir a
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Tag -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Tag -> (forall d. Data d => d -> u) -> Bias dir a -> u
forall u. (forall d. Data d => d -> u) -> Bias dir a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
Typeable (Bias dir a)
forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
Bias dir a -> Constr
forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
Bias dir a -> DataType
forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
(forall b. Data b => b -> b) -> Bias dir a -> Bias dir a
forall (dir :: IndexPreference) a u.
(Typeable dir, Data a) =>
Tag -> (forall d. Data d => d -> u) -> Bias dir a -> u
forall (dir :: IndexPreference) a u.
(Typeable dir, Data a) =>
(forall d. Data d => d -> u) -> Bias dir a -> [u]
forall (dir :: IndexPreference) a r r'.
(Typeable dir, Data a) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
forall (dir :: IndexPreference) a r r'.
(Typeable dir, Data a) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
forall (dir :: IndexPreference) a (m :: * -> *).
(Typeable dir, Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
forall (dir :: IndexPreference) a (m :: * -> *).
(Typeable dir, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
forall (dir :: IndexPreference) a (c :: * -> *).
(Typeable dir, Data a) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Bias dir a)
forall (dir :: IndexPreference) a (c :: * -> *).
(Typeable dir, Data a) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a)
forall (dir :: IndexPreference) a (t :: * -> *) (c :: * -> *).
(Typeable dir, Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Bias dir a))
forall (dir :: IndexPreference) a (t :: * -> * -> *) (c :: * -> *).
(Typeable dir, Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Bias dir a))
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Bias dir a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Bias dir a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Bias dir a))
$cgfoldl :: forall (dir :: IndexPreference) a (c :: * -> *).
(Typeable dir, Data a) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a)
$cgunfold :: forall (dir :: IndexPreference) a (c :: * -> *).
(Typeable dir, Data a) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Bias dir a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Bias dir a)
$ctoConstr :: forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
Bias dir a -> Constr
toConstr :: Bias dir a -> Constr
$cdataTypeOf :: forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
Bias dir a -> DataType
dataTypeOf :: Bias dir a -> DataType
$cdataCast1 :: forall (dir :: IndexPreference) a (t :: * -> *) (c :: * -> *).
(Typeable dir, Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Bias dir a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Bias dir a))
$cdataCast2 :: forall (dir :: IndexPreference) a (t :: * -> * -> *) (c :: * -> *).
(Typeable dir, Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Bias dir a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Bias dir a))
$cgmapT :: forall (dir :: IndexPreference) a.
(Typeable dir, Data a) =>
(forall b. Data b => b -> b) -> Bias dir a -> Bias dir a
gmapT :: (forall b. Data b => b -> b) -> Bias dir a -> Bias dir a
$cgmapQl :: forall (dir :: IndexPreference) a r r'.
(Typeable dir, Data a) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
$cgmapQr :: forall (dir :: IndexPreference) a r r'.
(Typeable dir, Data a) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Bias dir a -> r
$cgmapQ :: forall (dir :: IndexPreference) a u.
(Typeable dir, Data a) =>
(forall d. Data d => d -> u) -> Bias dir a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Bias dir a -> [u]
$cgmapQi :: forall (dir :: IndexPreference) a u.
(Typeable dir, Data a) =>
Tag -> (forall d. Data d => d -> u) -> Bias dir a -> u
gmapQi :: forall u. Tag -> (forall d. Data d => d -> u) -> Bias dir a -> u
$cgmapM :: forall (dir :: IndexPreference) a (m :: * -> *).
(Typeable dir, Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
$cgmapMp :: forall (dir :: IndexPreference) a (m :: * -> *).
(Typeable dir, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
$cgmapMo :: forall (dir :: IndexPreference) a (m :: * -> *).
(Typeable dir, Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a)
Data, Bias dir a -> Bias dir a -> Bool
(Bias dir a -> Bias dir a -> Bool)
-> (Bias dir a -> Bias dir a -> Bool) -> Eq (Bias dir a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (dir :: IndexPreference) a.
Eq a =>
Bias dir a -> Bias dir a -> Bool
$c== :: forall (dir :: IndexPreference) a.
Eq a =>
Bias dir a -> Bias dir a -> Bool
== :: Bias dir a -> Bias dir a -> Bool
$c/= :: forall (dir :: IndexPreference) a.
Eq a =>
Bias dir a -> Bias dir a -> Bool
/= :: Bias dir a -> Bias dir a -> Bool
Eq, (forall m. Monoid m => Bias dir m -> m)
-> (forall m a. Monoid m => (a -> m) -> Bias dir a -> m)
-> (forall m a. Monoid m => (a -> m) -> Bias dir a -> m)
-> (forall a b. (a -> b -> b) -> b -> Bias dir a -> b)
-> (forall a b. (a -> b -> b) -> b -> Bias dir a -> b)
-> (forall b a. (b -> a -> b) -> b -> Bias dir a -> b)
-> (forall b a. (b -> a -> b) -> b -> Bias dir a -> b)
-> (forall a. (a -> a -> a) -> Bias dir a -> a)
-> (forall a. (a -> a -> a) -> Bias dir a -> a)
-> (forall a. Bias dir a -> [a])
-> (forall a. Bias dir a -> Bool)
-> (forall a. Bias dir a -> Tag)
-> (forall a. Eq a => a -> Bias dir a -> Bool)
-> (forall a. Ord a => Bias dir a -> a)
-> (forall a. Ord a => Bias dir a -> a)
-> (forall a. Num a => Bias dir a -> a)
-> (forall a. Num a => Bias dir a -> a)
-> Foldable (Bias dir)
forall a. Eq a => a -> Bias dir a -> Bool
forall a. Num a => Bias dir a -> a
forall a. Ord a => Bias dir a -> a
forall m. Monoid m => Bias dir m -> m
forall a. Bias dir a -> Bool
forall a. Bias dir a -> Tag
forall a. Bias dir a -> [a]
forall a. (a -> a -> a) -> Bias dir a -> a
forall m a. Monoid m => (a -> m) -> Bias dir a -> m
forall b a. (b -> a -> b) -> b -> Bias dir a -> b
forall a b. (a -> b -> b) -> b -> Bias dir a -> b
forall (dir :: IndexPreference) a. Eq a => a -> Bias dir a -> Bool
forall (dir :: IndexPreference) a. Num a => Bias dir a -> a
forall (dir :: IndexPreference) a. Ord a => Bias dir a -> a
forall (dir :: IndexPreference) m. Monoid m => Bias dir m -> m
forall (dir :: IndexPreference) a. Bias dir a -> Bool
forall (dir :: IndexPreference) a. Bias dir a -> Tag
forall (dir :: IndexPreference) a. Bias dir a -> [a]
forall (dir :: IndexPreference) a. (a -> a -> a) -> Bias dir a -> a
forall (dir :: IndexPreference) m a.
Monoid m =>
(a -> m) -> Bias dir a -> m
forall (dir :: IndexPreference) b a.
(b -> a -> b) -> b -> Bias dir a -> b
forall (dir :: IndexPreference) a b.
(a -> b -> b) -> b -> Bias dir a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Tag)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (dir :: IndexPreference) m. Monoid m => Bias dir m -> m
fold :: forall m. Monoid m => Bias dir m -> m
$cfoldMap :: forall (dir :: IndexPreference) m a.
Monoid m =>
(a -> m) -> Bias dir a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Bias dir a -> m
$cfoldMap' :: forall (dir :: IndexPreference) m a.
Monoid m =>
(a -> m) -> Bias dir a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Bias dir a -> m
$cfoldr :: forall (dir :: IndexPreference) a b.
(a -> b -> b) -> b -> Bias dir a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Bias dir a -> b
$cfoldr' :: forall (dir :: IndexPreference) a b.
(a -> b -> b) -> b -> Bias dir a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Bias dir a -> b
$cfoldl :: forall (dir :: IndexPreference) b a.
(b -> a -> b) -> b -> Bias dir a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Bias dir a -> b
$cfoldl' :: forall (dir :: IndexPreference) b a.
(b -> a -> b) -> b -> Bias dir a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Bias dir a -> b
$cfoldr1 :: forall (dir :: IndexPreference) a. (a -> a -> a) -> Bias dir a -> a
foldr1 :: forall a. (a -> a -> a) -> Bias dir a -> a
$cfoldl1 :: forall (dir :: IndexPreference) a. (a -> a -> a) -> Bias dir a -> a
foldl1 :: forall a. (a -> a -> a) -> Bias dir a -> a
$ctoList :: forall (dir :: IndexPreference) a. Bias dir a -> [a]
toList :: forall a. Bias dir a -> [a]
$cnull :: forall (dir :: IndexPreference) a. Bias dir a -> Bool
null :: forall a. Bias dir a -> Bool
$clength :: forall (dir :: IndexPreference) a. Bias dir a -> Tag
length :: forall a. Bias dir a -> Tag
$celem :: forall (dir :: IndexPreference) a. Eq a => a -> Bias dir a -> Bool
elem :: forall a. Eq a => a -> Bias dir a -> Bool
$cmaximum :: forall (dir :: IndexPreference) a. Ord a => Bias dir a -> a
maximum :: forall a. Ord a => Bias dir a -> a
$cminimum :: forall (dir :: IndexPreference) a. Ord a => Bias dir a -> a
minimum :: forall a. Ord a => Bias dir a -> a
$csum :: forall (dir :: IndexPreference) a. Num a => Bias dir a -> a
sum :: forall a. Num a => Bias dir a -> a
$cproduct :: forall (dir :: IndexPreference) a. Num a => Bias dir a -> a
product :: forall a. Num a => Bias dir a -> a
Foldable, (forall a b. (a -> b) -> Bias dir a -> Bias dir b)
-> (forall a b. a -> Bias dir b -> Bias dir a)
-> Functor (Bias dir)
forall a b. a -> Bias dir b -> Bias dir a
forall a b. (a -> b) -> Bias dir a -> Bias dir b
forall (dir :: IndexPreference) a b. a -> Bias dir b -> Bias dir a
forall (dir :: IndexPreference) a b.
(a -> b) -> Bias dir a -> Bias dir b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (dir :: IndexPreference) a b.
(a -> b) -> Bias dir a -> Bias dir b
fmap :: forall a b. (a -> b) -> Bias dir a -> Bias dir b
$c<$ :: forall (dir :: IndexPreference) a b. a -> Bias dir b -> Bias dir a
<$ :: forall a b. a -> Bias dir b -> Bias dir a
Functor, Eq (Bias dir a)
Eq (Bias dir a) =>
(Bias dir a -> Bias dir a -> Ordering)
-> (Bias dir a -> Bias dir a -> Bool)
-> (Bias dir a -> Bias dir a -> Bool)
-> (Bias dir a -> Bias dir a -> Bool)
-> (Bias dir a -> Bias dir a -> Bool)
-> (Bias dir a -> Bias dir a -> Bias dir a)
-> (Bias dir a -> Bias dir a -> Bias dir a)
-> Ord (Bias dir a)
Bias dir a -> Bias dir a -> Bool
Bias dir a -> Bias dir a -> Ordering
Bias dir a -> Bias dir a -> Bias dir a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (dir :: IndexPreference) a. Ord a => Eq (Bias dir a)
forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bool
forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Ordering
forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bias dir a
$ccompare :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Ordering
compare :: Bias dir a -> Bias dir a -> Ordering
$c< :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bool
< :: Bias dir a -> Bias dir a -> Bool
$c<= :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bool
<= :: Bias dir a -> Bias dir a -> Bool
$c> :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bool
> :: Bias dir a -> Bias dir a -> Bool
$c>= :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bool
>= :: Bias dir a -> Bias dir a -> Bool
$cmax :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bias dir a
max :: Bias dir a -> Bias dir a -> Bias dir a
$cmin :: forall (dir :: IndexPreference) a.
Ord a =>
Bias dir a -> Bias dir a -> Bias dir a
min :: Bias dir a -> Bias dir a -> Bias dir a
Ord, ReadPrec [Bias dir a]
ReadPrec (Bias dir a)
Tag -> ReadS (Bias dir a)
ReadS [Bias dir a]
(Tag -> ReadS (Bias dir a))
-> ReadS [Bias dir a]
-> ReadPrec (Bias dir a)
-> ReadPrec [Bias dir a]
-> Read (Bias dir a)
forall a.
(Tag -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (dir :: IndexPreference) a. Read a => ReadPrec [Bias dir a]
forall (dir :: IndexPreference) a. Read a => ReadPrec (Bias dir a)
forall (dir :: IndexPreference) a.
Read a =>
Tag -> ReadS (Bias dir a)
forall (dir :: IndexPreference) a. Read a => ReadS [Bias dir a]
$creadsPrec :: forall (dir :: IndexPreference) a.
Read a =>
Tag -> ReadS (Bias dir a)
readsPrec :: Tag -> ReadS (Bias dir a)
$creadList :: forall (dir :: IndexPreference) a. Read a => ReadS [Bias dir a]
readList :: ReadS [Bias dir a]
$creadPrec :: forall (dir :: IndexPreference) a. Read a => ReadPrec (Bias dir a)
readPrec :: ReadPrec (Bias dir a)
$creadListPrec :: forall (dir :: IndexPreference) a. Read a => ReadPrec [Bias dir a]
readListPrec :: ReadPrec [Bias dir a]
Read, Tag -> Bias dir a -> ShowS
[Bias dir a] -> ShowS
Bias dir a -> String
(Tag -> Bias dir a -> ShowS)
-> (Bias dir a -> String)
-> ([Bias dir a] -> ShowS)
-> Show (Bias dir a)
forall a.
(Tag -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (dir :: IndexPreference) a.
Show a =>
Tag -> Bias dir a -> ShowS
forall (dir :: IndexPreference) a. Show a => [Bias dir a] -> ShowS
forall (dir :: IndexPreference) a. Show a => Bias dir a -> String
$cshowsPrec :: forall (dir :: IndexPreference) a.
Show a =>
Tag -> Bias dir a -> ShowS
showsPrec :: Tag -> Bias dir a -> ShowS
$cshow :: forall (dir :: IndexPreference) a. Show a => Bias dir a -> String
show :: Bias dir a -> String
$cshowList :: forall (dir :: IndexPreference) a. Show a => [Bias dir a] -> ShowS
showList :: [Bias dir a] -> ShowS
Show, Functor (Bias dir)
Foldable (Bias dir)
(Functor (Bias dir), Foldable (Bias dir)) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Bias dir a -> f (Bias dir b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Bias dir (f a) -> f (Bias dir a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Bias dir a -> m (Bias dir b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Bias dir (m a) -> m (Bias dir a))
-> Traversable (Bias dir)
forall (dir :: IndexPreference). Functor (Bias dir)
forall (dir :: IndexPreference). Foldable (Bias dir)
forall (dir :: IndexPreference) (m :: * -> *) a.
Monad m =>
Bias dir (m a) -> m (Bias dir a)
forall (dir :: IndexPreference) (f :: * -> *) a.
Applicative f =>
Bias dir (f a) -> f (Bias dir a)
forall (dir :: IndexPreference) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bias dir a -> m (Bias dir b)
forall (dir :: IndexPreference) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bias dir a -> f (Bias dir b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Bias dir (m a) -> m (Bias dir a)
forall (f :: * -> *) a.
Applicative f =>
Bias dir (f a) -> f (Bias dir a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bias dir a -> m (Bias dir b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bias dir a -> f (Bias dir b)
$ctraverse :: forall (dir :: IndexPreference) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bias dir a -> f (Bias dir b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bias dir a -> f (Bias dir b)
$csequenceA :: forall (dir :: IndexPreference) (f :: * -> *) a.
Applicative f =>
Bias dir (f a) -> f (Bias dir a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Bias dir (f a) -> f (Bias dir a)
$cmapM :: forall (dir :: IndexPreference) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bias dir a -> m (Bias dir b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bias dir a -> m (Bias dir b)
$csequence :: forall (dir :: IndexPreference) (m :: * -> *) a.
Monad m =>
Bias dir (m a) -> m (Bias dir a)
sequence :: forall (m :: * -> *) a. Monad m => Bias dir (m a) -> m (Bias dir a)
Traversable, Typeable)
-- | @since 0.2
data IndexPreference = L | R
	deriving Typeable
type L = 'L
type R = 'R