Idris2Doc : Data.OrdPSQ

Data.OrdPSQ

(source)
Ordered Priority Search Queue

Reexports

importpublic Data.OrdPSQ.Internal

Definitions

empty : OrdPSQkpv
  The empty queue. O(1)

Totality: total
Visibility: export
singleton : k->p->v->OrdPSQkpv
  Build a queue with one element. O(1)

Totality: total
Visibility: export
null : OrdPSQkpv->Bool
  Is the queue empty? O(1)

Totality: total
Visibility: export
size : OrdPSQkpv->Nat
  The number of elements in a queue. O(1)

Totality: total
Visibility: export
lookup : Ordk=>k->OrdPSQkpv->Maybe (p, v)
  The priority and value of a given key, or Nothing
if the key is not bound. O(log n)

Totality: total
Visibility: export
member : Ordk=>k->OrdPSQkpv->Bool
  Check if a key is present in the queue. O(log n)

Totality: total
Visibility: export
notMember : Ordk=>k->OrdPSQkpv->Bool
  Is the key not a member of the queue? See also member. O(log n)

Totality: total
Visibility: export
findMin : OrdPSQkpv->Maybe (k, (p, v))
  The element with the lowest priority. O(1)

Totality: total
Visibility: export
insert : Ordk=>Ordp=>k->p->v->OrdPSQkpv->OrdPSQkpv
  Insert a new key, priority and value into the queue.
If the key is already present in the queue, the associated
priority and value are replaced with the supplied priority
and value. O(log n)

Totality: total
Visibility: export
map : (k->p->v->w) ->OrdPSQkpv->OrdPSQkpw
  Modify every value in the queue. O(n)

Totality: total
Visibility: export
unsafeMapMonotonic : (k->p->v-> (q, w)) ->OrdPSQkpv->OrdPSQkqw
  Maps a function over the values and priorities of the queue.
The function f must be monotonic with respect to the priorities.
I.e. if x < y, then fst (f k x v) < fst (f k y v).
The precondition is not checked.
If f is not monotonic, then the result
will be invalid. O(n)

Totality: total
Visibility: export
fold : (k->p->v->a->a) ->a->OrdPSQkpv->a
  Fold over every key, priority and value in the queue. O(n)

Totality: total
Visibility: export
foldr : (a->b->b) ->b->OrdPSQkpa->b
Totality: total
Visibility: export
foldl : (b->a->b) ->b->OrdPSQkpa->b
Totality: total
Visibility: export
deleteView : Ordk=>Ordp=>k->OrdPSQkpv->Maybe (p, (v, OrdPSQkpv))
  Delete a key and its priority and value from the queue.
If the key was present, the associated priority and value are returned in addition
to the updated queue. O(log n)

Totality: total
Visibility: export
insertView : Ordk=>Ordp=>k->p->v->OrdPSQkpv-> (Maybe (p, v), OrdPSQkpv)
  Insert a new key, priority and value into the queue.
If the key is already present in the queue,
then the evicted priority and value can be
found the first element of the returned tuple. O(log n)

Totality: total
Visibility: export
minView : Ordk=>Ordp=>OrdPSQkpv->Maybe (k, (p, (v, OrdPSQkpv)))
  Retrieve the binding with the least priority, and the
rest of the queue stripped of that binding. O(log n)

Totality: total
Visibility: export
atMostView : Ordk=>Ordp=>p->OrdPSQkpv-> (List (k, (p, v)), OrdPSQkpv)
  Return a list of elements ordered by key whose priorities are at most pt,
and the rest of the queue stripped of these elements.
The returned list of elements can be in any order: no guarantees there.

Totality: total
Visibility: export
delete : Ordk=>Ordp=>k->OrdPSQkpv->OrdPSQkpv
  Delete a key, its priority, and its value from the queue.
When the key is not a member of the queue,
the original queue is returned. O(log n)

Totality: total
Visibility: export
deleteMin : Ordk=>Ordp=>OrdPSQkpv->OrdPSQkpv
  Delete the binding with the least priority, and return the
rest of the queue stripped of that binding.
In case the queue is empty, the empty queue is returned again. O(log n)

Totality: total
Visibility: export
alter : Ordk=>Ordp=> (Maybe (p, v) -> (b, Maybe (p, v))) ->k->OrdPSQkpv-> (b, OrdPSQkpv)
  The expression alter f k queue alters the value x at k, or
absence thereof.
alter can be used to insert, delete, or update a value in a queue.
It also allows you to calculate an additional value b. O(log n)

Totality: total
Visibility: export
alterMin : Ordk=>Ordp=> (Maybe (k, (p, v)) -> (b, Maybe (k, (p, v)))) ->OrdPSQkpv-> (b, OrdPSQkpv)
  A variant of alter which works on the element with the minimum priority.
Unlike alter, this variant also allows you to change the key of the element. O(log n)

Totality: total
Visibility: export
fromList : Ordk=>Ordp=>List (k, (p, v)) ->OrdPSQkpv
  Build a queue from a list of (key, priority, value) tuples.
If the list contains more than one priority and value for the same key, the
last priority and value for the key is retained. O(n * log n)

Totality: total
Visibility: export
toList : OrdPSQkpv->List (k, (p, v))
  Convert a queue to a list of (key, priority, value) tuples. O(n)

Totality: total
Visibility: export
keys : OrdPSQkpv->Listk
  Obtain the list of present keys in the queue. O(n)

Totality: total
Visibility: export