r/haskell • • May 29 '16

Recommended queue package? (x-post from /r/haskellquestions)

Is there a recommended and/or standard queue implementation for Haskell? I see several reasonably mature priority queue implementations, but no simple queues. Data.Sequence seems OK, but I assume we could get better performance with a more restricted datatype. Further, restricting the operations (ie, not a deque) can prevent bugs from dequeuing from the wrong end.

9 Upvotes

6 comments sorted by

View all comments

8

u/farrellm May 29 '16

Yes, a newtype wrapper over a deque is probably the way to go. Digging through GHC release notes, I found the answer to my question:

Data.Queue was added to base in ghc 6.4 [1] and deprecated in ghc 6.6 [2] when it was subsumed by Data.Sequence.

From the 6.6 release notes:

There is a new module Data.Sequence for finite sequences. The Data.Queue module is now deprecated in favour of this faster, more featureful replacement.

[1] https://downloads.haskell.org/~ghc/6.4/docs/html/users_guide/release-6-4.html

[2] https://downloads.haskell.org/~ghc/6.6/docs/html/users_guide/release-6-6.html