{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} module Data.PQueue.Internals.Down where import Control.DeepSeq (NFData(rnf)) import Data.Foldable (Foldable (..)) #if __GLASGOW_HASKELL__ import Data.Data (Data) #endif newtype Down a = Down { forall a. Down a -> a unDown :: a } #if __GLASGOW_HASKELL__ deriving (Down a -> Down a -> Bool forall a. Eq a => Down a -> Down a -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Down a -> Down a -> Bool $c/= :: forall a. Eq a => Down a -> Down a -> Bool == :: Down a -> Down a -> Bool $c== :: forall a. Eq a => Down a -> Down a -> Bool Eq, Down a -> DataType Down a -> Constr forall {a}. Data a => Typeable (Down a) forall a. Data a => Down a -> DataType forall a. Data a => Down a -> Constr forall a. Data a => (forall b. Data b => b -> b) -> Down a -> Down a forall a u. Data a => Int -> (forall d. Data d => d -> u) -> Down a -> u forall a u. Data a => (forall d. Data d => d -> u) -> Down a -> [u] forall a r r'. Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r forall a r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r forall a (m :: * -> *). (Data a, Monad m) => (forall d. Data d => d -> m d) -> Down a -> m (Down a) forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> Down a -> m (Down a) forall a (c :: * -> *). Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Down a) forall a (c :: * -> *). Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Down a -> c (Down a) forall a (t :: * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c (Down a)) forall a (t :: * -> * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Down 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. Int -> (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 (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Down a) forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Down a -> c (Down a) forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Down a)) gmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) $cgmapMo :: forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> Down a -> m (Down a) gmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) $cgmapMp :: forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> Down a -> m (Down a) gmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) $cgmapM :: forall a (m :: * -> *). (Data a, Monad m) => (forall d. Data d => d -> m d) -> Down a -> m (Down a) gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Down a -> u $cgmapQi :: forall a u. Data a => Int -> (forall d. Data d => d -> u) -> Down a -> u gmapQ :: forall u. (forall d. Data d => d -> u) -> Down a -> [u] $cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> Down a -> [u] gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r $cgmapQr :: forall a r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r gmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r $cgmapQl :: forall a r r'. Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r gmapT :: (forall b. Data b => b -> b) -> Down a -> Down a $cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> Down a -> Down a dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Down a)) $cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Down a)) dataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Down a)) $cdataCast1 :: forall a (t :: * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c (Down a)) dataTypeOf :: Down a -> DataType $cdataTypeOf :: forall a. Data a => Down a -> DataType toConstr :: Down a -> Constr $ctoConstr :: forall a. Data a => Down a -> Constr gunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Down a) $cgunfold :: forall a (c :: * -> *). Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Down a) gfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Down a -> c (Down a) $cgfoldl :: forall a (c :: * -> *). Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Down a -> c (Down a) Data) #else deriving (Eq) #endif instance NFData a => NFData (Down a) where rnf :: Down a -> () rnf (Down a a) = forall a. NFData a => a -> () rnf a a instance Ord a => Ord (Down a) where Down a a compare :: Down a -> Down a -> Ordering `compare` Down a b = a b forall a. Ord a => a -> a -> Ordering `compare` a a Down a a <= :: Down a -> Down a -> Bool <= Down a b = a b forall a. Ord a => a -> a -> Bool <= a a Down a a >= :: Down a -> Down a -> Bool >= Down a b = a b forall a. Ord a => a -> a -> Bool >= a a Down a a < :: Down a -> Down a -> Bool < Down a b = a b forall a. Ord a => a -> a -> Bool < a a Down a a > :: Down a -> Down a -> Bool > Down a b = a b forall a. Ord a => a -> a -> Bool > a a instance Functor Down where fmap :: forall a b. (a -> b) -> Down a -> Down b fmap a -> b f (Down a a) = forall a. a -> Down a Down (a -> b f a a) instance Foldable Down where foldr :: forall a b. (a -> b -> b) -> b -> Down a -> b foldr a -> b -> b f b z (Down a a) = a a a -> b -> b `f` b z foldl :: forall b a. (b -> a -> b) -> b -> Down a -> b foldl b -> a -> b f b z (Down a a) = b z b -> a -> b `f` a a foldr' :: forall a b. (a -> b -> b) -> b -> Down a -> b foldr' a -> b -> b f !b z (Down a a) = a a a -> b -> b `f` b z foldl' :: forall b a. (b -> a -> b) -> b -> Down a -> b foldl' b -> a -> b f !b z (Down a a) = b z b -> a -> b `f` a a