Data.Edison.Coll.MinHeap

EdisonCore-1.3.1.1: A library of efficent, purely-functional data structures (Core Implementations)

Copyright | Copyright (c) 1999, 2008 Chris Okasaki
License | MIT; see COPYRIGHT file for terms and conditions
Maintainer | robdockins AT fastmail DOT fm
Stability | stable
Portability | GHC, Hugs (MPTC and FD)
Safe Haskell | None
Language | Haskell2010

Data.Edison.Coll.MinHeap

Contents

- Min heap adaptor type
- CollX operations
- Coll operations
- OrdCollX operations
- OrdColl operations
- Other supported operations
- Documentation

Description

A generic adaptor for bags to keep the minimum element separately.

Synopsis

- data Min h a
- empty :: Min h a
- singleton :: (CollX h a, Ord a) => a -> Min h a
- fromSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a
- insert :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a
- insertSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a -> Min h a
- union :: (OrdCollX h a, Ord a) => Min h a -> Min h a -> Min h a
- unionSeq :: (OrdColl h a, Ord a, Sequence s) => s (Min h a) -> Min h a
- delete :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a
- deleteAll :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a
- deleteSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a -> Min h a
- null :: Min h a -> Bool
- size :: CollX h a => Min h a -> Int
- member :: (CollX h a, Ord a) => a -> Min h a -> Bool
- count :: (CollX h a, Ord a) => a -> Min h a -> Int
- strict :: (CollX h a, Ord a) => Min h a -> Min h a
- structuralInvariant :: (Ord a, OrdColl h a) => Min h a -> Bool
- toSeq :: (Coll h a, Sequence s) => Min h a -> s a
- lookup :: (Coll h a, Ord a) => a -> Min h a -> a
- lookupM :: (Coll h a, Ord a, Monad m) => a -> Min h a -> m a
- lookupAll :: (Coll h a, Ord a, Sequence s) => a -> Min h a -> s a
- lookupWithDefault :: (Coll h a, Ord a) => a -> a -> Min h a -> a
- fold :: Coll h a => (a -> b -> b) -> b -> Min h a -> b
- fold' :: Coll h a => (a -> b -> b) -> b -> Min h a -> b
- fold1 :: Coll h a => (a -> a -> a) -> Min h a -> a
- fold1' :: Coll h a => (a -> a -> a) -> Min h a -> a
- filter :: OrdColl h a => (a -> Bool) -> Min h a -> Min h a
- partition :: OrdColl h a => (a -> Bool) -> Min h a -> (Min h a, Min h a)
- strictWith :: OrdColl h a => (a -> b) -> Min h a -> Min h a
- deleteMin :: (OrdColl h a, Ord a) => Min h a -> Min h a
- deleteMax :: (OrdCollX h a, Ord a) => Min h a -> Min h a
- unsafeInsertMin :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a
- unsafeInsertMax :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a
- unsafeFromOrdSeq :: (OrdCollX h a, Ord a, Sequence s) => s a -> Min h a
- unsafeAppend :: (OrdCollX h a, Ord a) => Min h a -> Min h a -> Min h a
- filterLT :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a
- filterLE :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a
- filterGT :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a
- filterGE :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a
- partitionLT_GE :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a)
- partitionLE_GT :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a)
- partitionLT_GT :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a)
- minView :: (OrdColl h a, Ord a, Monad m) => Min h a -> m (a, Min h a)
- minElem :: (OrdColl h a, Ord a) => Min h a -> a
- maxView :: (OrdColl h a, Ord a, Monad m) => Min h a -> m (a, Min h a)
- maxElem :: (OrdColl h a, Ord a) => Min h a -> a
- foldr :: (OrdColl h a, Ord a) => (a -> b -> b) -> b -> Min h a -> b
- foldr' :: (OrdColl h a, Ord a) => (a -> b -> b) -> b -> Min h a -> b
- foldl :: (OrdColl h a, Ord a) => (b -> a -> b) -> b -> Min h a -> b
- foldl' :: (OrdColl h a, Ord a) => (b -> a -> b) -> b -> Min h a -> b
- foldr1 :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a
- foldr1' :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a
- foldl1 :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a
- foldl1' :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a
- toOrdSeq :: (OrdColl h a, Ord a, Sequence s) => Min h a -> s a
- unsafeMapMonotonic :: (OrdColl h a, Ord a) => (a -> a) -> Min h a -> Min h a
- toColl :: OrdColl h a => Min h a -> h
- fromColl :: OrdColl h a => h -> Min h a
- moduleName :: String

# Min heap adaptor type

data Min h a #

Instances

(Eq h, Eq a) => Eq (Min h a) # |
Methods (==) :: Min h a -> Min h a -> Bool # (/=) :: Min h a -> Min h a -> Bool #
(Eq h, OrdColl h a) => Ord (Min h a) # |
Methods compare :: Min h a -> Min h a -> Ordering # (<) :: Min h a -> Min h a -> Bool # (<=) :: Min h a -> Min h a -> Bool # (>) :: Min h a -> Min h a -> Bool # (>=) :: Min h a -> Min h a -> Bool # max :: Min h a -> Min h a -> Min h a # min :: Min h a -> Min h a -> Min h a #
(OrdColl h a, Read h) => Read (Min h a) # |
Methods readsPrec :: Int -> ReadS (Min h a) # readList :: ReadS [Min h a] # readPrec :: ReadPrec (Min h a) # readListPrec :: ReadPrec [Min h a] #
(OrdColl h a, Show h) => Show (Min h a) # |
Methods showsPrec :: Int -> Min h a -> ShowS # show :: Min h a -> String # showList :: [Min h a] -> ShowS #
OrdColl h a => Monoid (Min h a) # |
Methods mempty :: Min h a # mappend :: Min h a -> Min h a -> Min h a # mconcat :: [Min h a] -> Min h a #
(OrdColl h a, Arbitrary h, Arbitrary a) => Arbitrary (Min h a) # |
Methods arbitrary :: Gen (Min h a) # shrink :: Min h a -> [Min h a] #
(OrdColl h a, CoArbitrary h, CoArbitrary a) => CoArbitrary (Min h a) # |
Methods coarbitrary :: Min h a -> Gen b -> Gen b #
(OrdColl h a, Ord a) => CollX (Min h a) a # |
Methods singleton :: a -> Min h a # fromSeq :: Sequence seq => seq a -> Min h a # unionSeq :: Sequence seq => seq (Min h a) -> Min h a # insert :: a -> Min h a -> Min h a # insertSeq :: Sequence seq => seq a -> Min h a -> Min h a # delete :: a -> Min h a -> Min h a # deleteAll :: a -> Min h a -> Min h a # deleteSeq :: Sequence seq => seq a -> Min h a -> Min h a # null :: Min h a -> Bool # size :: Min h a -> Int # member :: a -> Min h a -> Bool # count :: a -> Min h a -> Int # strict :: Min h a -> Min h a # structuralInvariant :: Min h a -> Bool # instanceName :: Min h a -> String #
(OrdColl h a, Ord a) => OrdCollX (Min h a) a # |
Methods deleteMin :: Min h a -> Min h a # deleteMax :: Min h a -> Min h a # unsafeInsertMin :: a -> Min h a -> Min h a # unsafeInsertMax :: a -> Min h a -> Min h a # unsafeFromOrdSeq :: Sequence seq => seq a -> Min h a # unsafeAppend :: Min h a -> Min h a -> Min h a # filterLT :: a -> Min h a -> Min h a # filterLE :: a -> Min h a -> Min h a # filterGT :: a -> Min h a -> Min h a # filterGE :: a -> Min h a -> Min h a # partitionLT_GE :: a -> Min h a -> (Min h a, Min h a) # partitionLE_GT :: a -> Min h a -> (Min h a, Min h a) # partitionLT_GT :: a -> Min h a -> (Min h a, Min h a) #
(OrdColl h a, Ord a) => Coll (Min h a) a # |
Methods toSeq :: Sequence seq => Min h a -> seq a # lookup :: a -> Min h a -> a # lookupM :: Monad m => a -> Min h a -> m a # lookupAll :: Sequence seq => a -> Min h a -> seq a # lookupWithDefault :: a -> a -> Min h a -> a # fold :: (a -> b -> b) -> b -> Min h a -> b # fold' :: (a -> b -> b) -> b -> Min h a -> b # fold1 :: (a -> a -> a) -> Min h a -> a # fold1' :: (a -> a -> a) -> Min h a -> a # filter :: (a -> Bool) -> Min h a -> Min h a # partition :: (a -> Bool) -> Min h a -> (Min h a, Min h a) # strictWith :: (a -> b) -> Min h a -> Min h a #
(OrdColl h a, Ord a) => OrdColl (Min h a) a # |
Methods minView :: Monad m => Min h a -> m (a, Min h a) # minElem :: Min h a -> a # maxView :: Monad m => Min h a -> m (a, Min h a) # maxElem :: Min h a -> a # foldr :: (a -> b -> b) -> b -> Min h a -> b # foldr' :: (a -> b -> b) -> b -> Min h a -> b # foldl :: (b -> a -> b) -> b -> Min h a -> b # foldl' :: (b -> a -> b) -> b -> Min h a -> b # foldr1 :: (a -> a -> a) -> Min h a -> a # foldr1' :: (a -> a -> a) -> Min h a -> a # foldl1 :: (a -> a -> a) -> Min h a -> a # foldl1' :: (a -> a -> a) -> Min h a -> a # toOrdSeq :: Sequence seq => Min h a -> seq a # unsafeMapMonotonic :: (a -> a) -> Min h a -> Min h a #

# CollX operations

empty :: Min h a #

singleton :: (CollX h a, Ord a) => a -> Min h a #

fromSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a #

insert :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a #

insertSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a -> Min h a #

union :: (OrdCollX h a, Ord a) => Min h a -> Min h a -> Min h a #

unionSeq :: (OrdColl h a, Ord a, Sequence s) => s (Min h a) -> Min h a #

delete :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a #

deleteAll :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a #

deleteSeq :: (OrdColl h a, Ord a, Sequence s) => s a -> Min h a -> Min h a #

null :: Min h a -> Bool #

size :: CollX h a => Min h a -> Int #

member :: (CollX h a, Ord a) => a -> Min h a -> Bool #

count :: (CollX h a, Ord a) => a -> Min h a -> Int #

strict :: (CollX h a, Ord a) => Min h a -> Min h a #

structuralInvariant :: (Ord a, OrdColl h a) => Min h a -> Bool #

# Coll operations

toSeq :: (Coll h a, Sequence s) => Min h a -> s a #

lookup :: (Coll h a, Ord a) => a -> Min h a -> a #

lookupM :: (Coll h a, Ord a, Monad m) => a -> Min h a -> m a #

lookupAll :: (Coll h a, Ord a, Sequence s) => a -> Min h a -> s a #

lookupWithDefault :: (Coll h a, Ord a) => a -> a -> Min h a -> a #

fold :: Coll h a => (a -> b -> b) -> b -> Min h a -> b #

fold' :: Coll h a => (a -> b -> b) -> b -> Min h a -> b #

fold1 :: Coll h a => (a -> a -> a) -> Min h a -> a #

fold1' :: Coll h a => (a -> a -> a) -> Min h a -> a #

filter :: OrdColl h a => (a -> Bool) -> Min h a -> Min h a #

partition :: OrdColl h a => (a -> Bool) -> Min h a -> (Min h a, Min h a) #

strictWith :: OrdColl h a => (a -> b) -> Min h a -> Min h a #

# OrdCollX operations

deleteMin :: (OrdColl h a, Ord a) => Min h a -> Min h a #

deleteMax :: (OrdCollX h a, Ord a) => Min h a -> Min h a #

unsafeInsertMin :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a #

unsafeInsertMax :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a #

unsafeFromOrdSeq :: (OrdCollX h a, Ord a, Sequence s) => s a -> Min h a #

unsafeAppend :: (OrdCollX h a, Ord a) => Min h a -> Min h a -> Min h a #

filterLT :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a #

filterLE :: (OrdCollX h a, Ord a) => a -> Min h a -> Min h a #

filterGT :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a #

filterGE :: (OrdColl h a, Ord a) => a -> Min h a -> Min h a #

partitionLT_GE :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a) #

partitionLE_GT :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a) #

partitionLT_GT :: (OrdColl h a, Ord a) => a -> Min h a -> (Min h a, Min h a) #

# OrdColl operations

minView :: (OrdColl h a, Ord a, Monad m) => Min h a -> m (a, Min h a) #

minElem :: (OrdColl h a, Ord a) => Min h a -> a #

maxView :: (OrdColl h a, Ord a, Monad m) => Min h a -> m (a, Min h a) #

maxElem :: (OrdColl h a, Ord a) => Min h a -> a #

foldr :: (OrdColl h a, Ord a) => (a -> b -> b) -> b -> Min h a -> b #

foldr' :: (OrdColl h a, Ord a) => (a -> b -> b) -> b -> Min h a -> b #

foldl :: (OrdColl h a, Ord a) => (b -> a -> b) -> b -> Min h a -> b #

foldl' :: (OrdColl h a, Ord a) => (b -> a -> b) -> b -> Min h a -> b #

foldr1 :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a #

foldr1' :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a #

foldl1 :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a #

foldl1' :: (OrdColl h a, Ord a) => (a -> a -> a) -> Min h a -> a #

toOrdSeq :: (OrdColl h a, Ord a, Sequence s) => Min h a -> s a #

unsafeMapMonotonic :: (OrdColl h a, Ord a) => (a -> a) -> Min h a -> Min h a #

# Other supported operations

toColl :: OrdColl h a => Min h a -> h #

fromColl :: OrdColl h a => h -> Min h a #

# Documentation

moduleName :: String #