Haskell的标准队列包? [英] Standard queue package for Haskell?

查看:70
本文介绍了Haskell的标准队列包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Haskell是否有标准的队列实现?我看到了几种相当成熟的优先级队列实现,但没有简单的队列. Data.Sequence似乎还可以,但是我认为使用更严格的数据类型可以获得更好的性能.此外,限制操作(即不是双端队列)可以防止错误从错误的一端使队列出队列.

澄清一下,我希望有一个成熟的Haskell实现,最好是在Haskell Platform或Hackage中.

解决方案

Data.Queue在ghc 6.4 [1]中添加到了base中,并在ghc 6.6 [2]中被Data.Sequence包含时弃用了. /p>

摘自6.6发行说明:

有一个新的模块Data.Sequence用于有限序列.现在不建议使用Data.Queue模块,而希望使用这种更快,功能更丰富的替换方法.

[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

Is there a 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.

Edit:

To clarify, I was hoping for a mature Haskell implementation, preferably in Haskell Platform or Hackage.

解决方案

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

这篇关于Haskell的标准队列包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆