I have an algorithm which would benefit from the use of an Ordered Set (Oset) in Haskell. When I have such a Set I would like to convert it to a list where the order in the list is the insertion order in the set. The documentation for Data.Set.Ordered http://hackage.haskell.org/package/ordered-containers-0.2.2/docs/Data-Set-Ordered.html#t:OSet points me to Data.Foldable http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Foldable.html#v:toList to get what I require. But I don't seem to know enough Haskell to see how this helps. Can anyone give me an example of how to use an Ordered Set such that it implements .toList?
Data.Foldable.toList
帮助,因为它可以在Foldable
任何实例上工作,而Data.Set.Ordered.OSet
是Foldable
的实例。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.