module Data.Heap.Ekmett (H.Heap, module HC) where import qualified Data.Foldable as F import qualified Data.Heap as H import qualified Data.Heap.Class as HC instance HC.Heap H.Heap where empty :: Heap a empty = Heap a forall a. Heap a H.empty {-# INLINE empty #-} null :: Heap a -> Bool null = Heap a -> Bool forall a. Heap a -> Bool H.null {-# INLINE null #-} insert :: a -> Heap a -> Heap a insert = a -> Heap a -> Heap a forall a. Ord a => a -> Heap a -> Heap a H.insert {-# INLINE insert #-} merge :: Heap a -> Heap a -> Heap a merge = Heap a -> Heap a -> Heap a forall a. Heap a -> Heap a -> Heap a H.union {-# INLINE merge #-} findMin :: Heap a -> Maybe a findMin = ((a, Heap a) -> a) -> Maybe (a, Heap a) -> Maybe a forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap (a, Heap a) -> a forall a b. (a, b) -> a fst (Maybe (a, Heap a) -> Maybe a) -> (Heap a -> Maybe (a, Heap a)) -> Heap a -> Maybe a forall b c a. (b -> c) -> (a -> b) -> a -> c . Heap a -> Maybe (a, Heap a) forall a. Heap a -> Maybe (a, Heap a) H.viewMin {-# INLINE findMin #-} deleteMin :: Heap a -> Maybe (Heap a) deleteMin = ((a, Heap a) -> Heap a) -> Maybe (a, Heap a) -> Maybe (Heap a) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap (a, Heap a) -> Heap a forall a b. (a, b) -> b snd (Maybe (a, Heap a) -> Maybe (Heap a)) -> (Heap a -> Maybe (a, Heap a)) -> Heap a -> Maybe (Heap a) forall b c a. (b -> c) -> (a -> b) -> a -> c . Heap a -> Maybe (a, Heap a) forall a. Heap a -> Maybe (a, Heap a) H.viewMin {-# INLINE deleteMin #-} singleton :: a -> Heap a singleton = a -> Heap a forall a. Ord a => a -> Heap a H.singleton {-# INLINE singleton #-} span :: (a -> Bool) -> Heap a -> (Heap a, Heap a) span = (a -> Bool) -> Heap a -> (Heap a, Heap a) forall a. (a -> Bool) -> Heap a -> (Heap a, Heap a) H.span {-# INLINE span #-} toList :: Heap a -> [a] toList = Heap a -> [a] forall (t :: * -> *) a. Foldable t => t a -> [a] F.toList {-# INLINE toList #-} fromList :: [a] -> Heap a fromList = [a] -> Heap a forall a. Ord a => [a] -> Heap a H.fromList {-# INLINE fromList #-}