Safe Haskell | None |
---|---|

Language | Haskell2010 |

Classes for the various heaps, mainly to avoid name clashing.

# Documentation

class Queue h a where Source #

A class for queues. Conforming members can have their own
definition of order on their contents. (i.e., `Ord`

is not required)

minView :: h a -> Maybe (a, h a) Source #

Return the first element, and the remaining elements,
or `Nothing`

if the queue is empty. For most queues,
this will be the minimal element

insert :: a -> h a -> h a Source #

Insert an element into the queue.

The empty queue.

singleton :: a -> h a Source #

A queue with one element.

Return a list of the contents of the queue, in order, from smallest to largest.

fromList :: [a] -> h a Source #

Create a heap from a list.

heapSort :: p h -> [a] -> [a] Source #

Perform heap sort on a list of items.

Queue [] a Source # | |

Ord a => Queue Set a Source # | |

Ord a => Queue Leftist a Source # | |

Ord a => Queue Pairing a Source # | |

Ord a => Queue Braun a Source # | |

Ord a => Queue Skew a Source # | |

IndexedQueue h a => Queue (ErasedSize h) a Source # | |

Queue f a => Queue (WithDict f) a Source # | |

Ord a => Queue (Binomial Z) a Source # | |

class Queue h a => MeldableQueue h a where Source #

merge :: h a -> h a -> h a Source #

Merge two heaps. This operation is associative, and has the
identity of `empty`

.

`merge`

x (`merge`

y z) =`merge`

(`merge`

x y) z

`merge`

x`empty`

=`merge`

`empty`

x = x

fromFoldable :: Foldable f => f a -> h a Source #

MeldableQueue [] a Source # | |

Ord a => MeldableQueue Set a Source # | |

Ord a => MeldableQueue Leftist a Source # | |

Ord a => MeldableQueue Pairing a Source # | |

Ord a => MeldableQueue Skew a Source # | |

MeldableIndexedQueue h a => MeldableQueue (ErasedSize h) a Source # | |

MeldableQueue f a => MeldableQueue (WithDict f) a Source # | |

Ord a => MeldableQueue (Binomial Z) a Source # | |

showsPrecQueue :: (Queue h a, Show a) => Int -> h a -> ShowS Source #

A default definition for `showsPrec`

.