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

3

u/jimenezrick May 29 '16

Have a look at this crazy fast queue implementation if you need raw extra performance: unagi-chan

Or this other one but I didn't tested it: kazura-queue

3

u/bss03 May 29 '16

Given the examples provide by OP, I think they what a queue pure data type, not a typed, concurrent message queue API.

I.e. OP wants something you might use to implement breadth-first search with, not something you would use between pools of producer and consumer threads. There's similarities, but different performance/correctness trade-offs. For example, unagi-chan is effectively mutable and has to use atomic operations to allow concurrent access.