Idris2Doc : Data.HashPSQ

Data.HashPSQ

(source)
Hash Priority Search Queue

Reexports

importpublic Data.HashPSQ.Internal
importpublic Data.NatPSQ
importpublic Data.NatPSQ.Internal
importpublic Data.OrdPSQ

Definitions

insert : Hashablek=>Ordk=>Ordp=>k->p->v->HashPSQkpv->HashPSQkpv
  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(min(n, W))

Totality: total
Visibility: export
empty : HashPSQkpv
  The empty queue. O(1)

Totality: total
Visibility: export
singleton : Hashablek=>Ordk=>Ordp=>k->p->v->HashPSQkpv
  Build a queue with one element. O(1)

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

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

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

Totality: total
Visibility: export
member : Hashablek=>Ordk=>Ordp=>k->HashPSQkpv->Bool
  Check if a key is present in the queue. O(min(n, W))

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

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

Totality: total
Visibility: export
deleteView : Hashablek=>Ordk=>Ordp=>k->HashPSQkpv->Maybe (p, (v, HashPSQkpv))
  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(min(n, W))

Totality: total
Visibility: export
insertView : Hashablek=>Ordk=>Ordp=>k->p->v->HashPSQkpv-> (Maybe (p, v), HashPSQkpv)
  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(min(n, W))

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

Totality: total
Visibility: export
atMostView : Hashablek=>Ordk=>Ordp=>p->HashPSQkpv-> (List (k, (p, v)), HashPSQkpv)
  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 : Hashablek=>Ordk=>Ordp=>k->HashPSQkpv->HashPSQkpv
  Delete a key and its priority and value from the queue.
When the key is not a member of the queue, the original queue is returned. O(min(n, W))

Totality: total
Visibility: export
deleteMin : Hashablek=>Ordk=>Ordp=>HashPSQkpv->HashPSQkpv
  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(min(n, W))

Totality: total
Visibility: export
alter : Hashablek=>Ordk=>Ordp=> (Maybe (p, v) -> (b, Maybe (p, v))) ->k->HashPSQkpv-> (b, HashPSQkpv)
  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(min(n, w))

Totality: total
Visibility: export
alterMin : Hashablek=>Ordk=>Ordp=> (Maybe (k, (p, v)) -> (b, Maybe (k, (p, v)))) ->HashPSQkpv-> (b, HashPSQkpv)
  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(min(n, W))

Totality: total
Visibility: export
map : (v->w) ->HashPSQkpv->HashPSQkpw
  Modify every value in the queue. O(n)

Totality: total
Visibility: export
fromList : Hashablek=>Ordk=>Ordp=>List (k, (p, v)) ->HashPSQkpv
  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(min(n, W))

Totality: total
Visibility: export
toList : Hashablek=>Ordk=>Ordp=>HashPSQkpv->List (k, (p, v))
  Convert a queue to a list of (key, priority, value) tuples. The
order of the list is not specified. O(n)

Totality: total
Visibility: export
keys : Hashablek=>Ordk=>Ordp=>HashPSQkpv->Listk
  Obtain the list of present keys in the queue. O(n)

Totality: total
Visibility: export