Alexander Solla | 20 Jan 19:59 2013
Picon

Container libraries

Hi everybody,

What is the state of container libraries?  I am looking for a library which provides:

* unordered containers (for "operational" type safety, I don't want to impose orders on things that don't have them -- unordered containers does this)
* can handled nested containers (containers does that)
* can be serialized easily, or better yet, has Generic instances

Does such a library exist?  What are you using for Set and Map needs?

I have been fond of unordered-containers for a while, but found difficulty in creating HashSets of, for example, HashMaps, since there are no Hashable instances for their polymorphic types.  I even dug into the code, looking at the possibility of submitting a patch, but gave up when I ran into funky #-suffixed values, which stymied my initial attempt.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Ertugrul Söylemez | 20 Jan 20:39 2013
Picon

Re: Container libraries

Alexander Solla <alex.solla <at> gmail.com> wrote:

> What is the state of container libraries?  I am looking for a library
> which provides:
>
> * unordered containers (for "operational" type safety, I don't want to
> impose orders on things that don't have them -- unordered containers
> does this)

You are imposing an order.

> * can handled nested containers (containers does that)
> * can be serialized easily, or better yet, has Generic instances
>
> Does such a library exist?  What are you using for Set and Map needs?

What's wrong with 'containers' itself?  I prefer Map/Set over
HashMap/HashSet, because the speed difference is small and only
noticable for large maps/sets.  If you need multiple indices, there is
IxSet.

The advantage of those is that their speed and memory behavior is more
predictable, and they're not subject to hash collision attacks.

Serializing them is done by importing your favorite serialization
package, be it binary, cereal or safecopy/acid-state.  They all have the
necessary instances.

For all these reasons I'm not a big fan of hash-based data structures,
particularly hash tables.

Greets,
Ertugrul

--

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Alexander Solla | 20 Jan 21:06 2013
Picon

Re: Container libraries


On Sun, Jan 20, 2013 at 11:39 AM, Ertugrul Söylemez <es <at> ertes.de> wrote:
> What is the state of container libraries?  I am looking for a library
> which provides:
>
> * unordered containers (for "operational" type safety, I don't want to
> impose orders on things that don't have them -- unordered containers
> does this)

You are imposing an order.

I mean I don't want Ord instances for types with no "natural" order.  I don't mind that a container structure will impose the topological order, or that containers can be ordered by inclusion.

In particular, I have datatypes whose values represent incomparable "atoms" of some type.  A comparison between them should "really" yield bottom.  So an Ord-based container is not appropriate.  I'd rather not have an Ord instance for these types and therefore statically eliminate that bottom.
 


> * can handled nested containers (containers does that)
> * can be serialized easily, or better yet, has Generic instances
>
> Does such a library exist?  What are you using for Set and Map needs?

What's wrong with 'containers' itself?  I prefer Map/Set over
HashMap/HashSet, because the speed difference is small and only
noticable for large maps/sets.  If you need multiple indices, there is
IxSet.

I took a look at 'hashmap', which uses 'hashable' and 'containers' to implement hash containers.  I worried about the performance, and thought I'd ask for opinions on containers.

My goal is to create an IxSet-like structure which can handle unordered types, and preferably whose indices can be derived GHC.Generics-ally.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane