Idris2Doc : Data.NatPSQ

Data.NatPSQ

(source)
Ordered Nat Priority Search Queue

Reexports

importpublic Data.NatPSQ.Internal

Definitions

unsafeInsertNew : Ordp=>Key->p->v->NatPSQpv->NatPSQpv
  Internal function to insert a key that is *not* present in the priority queue.

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

Totality: total
Visibility: export
singleton : Ordp=>Nat->p->v->NatPSQpv
  Build a queue with one element. O(1)

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

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

Totality: total
Visibility: export
lookup : Nat->NatPSQpv->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 : Nat->NatPSQpv->Bool
  Check if a key is present in the queue. O(log n)

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

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

Totality: total
Visibility: export
deleteView : Ordp=>Nat->NatPSQpv->Maybe (p, (v, NatPSQpv))
  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 : Ordp=>Nat->p->v->NatPSQpv-> (Maybe (p, v), NatPSQpv)
  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 : Ordp=>NatPSQpv->Maybe (Nat, (p, (v, NatPSQpv)))
  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 : Ordp=>p->NatPSQpv-> (List (Nat, (p, v)), NatPSQpv)
  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 : Ordp=>Nat->NatPSQpv->NatPSQpv
  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 : Ordp=>NatPSQpv->NatPSQpv
  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
insert : Ordp=>Nat->p->v->NatPSQpv->NatPSQpv
  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
alter : Ordp=> (Maybe (p, v) -> (b, Maybe (p, v))) ->Nat->NatPSQpv-> (b, NatPSQpv)
  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 : Ordp=> (Maybe (Nat, (p, v)) -> (b, Maybe (Nat, (p, v)))) ->NatPSQpv-> (b, NatPSQpv)
  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) ->NatPSQpv->NatPSQpw
  Modify every value in the queue. O(n)

Totality: total
Visibility: export
unsafeMapMonotonic : (Key->p->v-> (q, w)) ->NatPSQpv->NatPSQqw
  Maps a function over the values and priorities of the queue.
The function f must be monotonic with respect to the priorities.
This means that 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 : (Nat->p->v->a->a) ->a->NatPSQpv->a
  Fold over every key, priority and value in the queue.
The order in which the fold is performed is not specified. O(n)

Totality: total
Visibility: export
foldl : (acc->v->acc) ->acc->NatPSQpv->acc
Totality: total
Visibility: export
foldr : (v->acc->acc) ->acc->NatPSQpv->acc
Totality: total
Visibility: export
fromList : Ordp=>List (Nat, (p, v)) ->NatPSQpv
  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 * min(n, W))

Totality: total
Visibility: export
toList : NatPSQpv->List (Nat, (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 : NatPSQpv->ListNat
  Obtain the list of present keys in the queue. O(n)

Totality: total
Visibility: export