Skip to content

Commit 6bca471

Browse files
committed
Fix docs
1 parent b70d8bb commit 6bca471

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/PriorityQueue.purs

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ import Effect (Effect)
3131
-- API
3232

3333
-- | A priority queue that allows for efficient insertion and removal of elements.
34-
-- The queue can be created with a custom ordering function that determines the
35-
-- priority of elements.
36-
-- Note: it's not possible to have a meaninful Eq instance, as two queues with
37-
-- the same elements might have them in different order due to the heap structure.
38-
-- It's recommended to convert the queue to an array to compare it.
34+
-- | The queue can be created with a custom ordering function that determines the
35+
-- | priority of elements.
36+
-- | Note: it's not possible to have a meaninful Eq instance, as two queues with
37+
-- | the same elements might have them in different order due to the heap structure.
38+
-- | It's recommended to convert the queue to an array to compare it.
3939
newtype Queue a = Queue
4040
{ contents :: STArray Global a
4141
, ordering :: a -> a -> Boolean
4242
}
4343

4444
-- | Create a new priority queue where the element with the smallest value
45-
-- according to the provided function will be at the front of the queue.
45+
-- | according to the provided function will be at the front of the queue.
4646
newMinQueue :: forall a. (a -> Number) -> Effect (Queue a)
4747
newMinQueue fn = toEffect do
4848
contents <- STA.new
@@ -52,7 +52,7 @@ newMinQueue fn = toEffect do
5252
}
5353

5454
-- | Create a new priority queue where the element with the largest value
55-
-- according to the provided function will be at the front of the queue.
55+
-- | according to the provided function will be at the front of the queue.
5656
newMaxQueue :: forall a. (a -> Number) -> Effect (Queue a)
5757
newMaxQueue fn = toEffect do
5858
contents <- STA.new
@@ -76,8 +76,8 @@ pop (Queue { contents, ordering }) = toEffect do
7676
removeMax contents ordering
7777

7878
-- | Remove and return the first n elements from the queue.
79-
-- Note: we guarantee that the elements are sorted in the order of the queue,
80-
-- first element is the one with the highest priority.
79+
-- | Note: we guarantee that the elements are sorted in the order of the queue,
80+
-- | first element is the one with the highest priority.
8181
popN :: forall a. Int -> Queue a -> Effect (Array a)
8282
popN n (Queue { contents, ordering }) = toEffect do
8383
result <- STA.new

0 commit comments

Comments
 (0)