[Haskell-cafe] Re: Layered maps

Ben Franksen ben.franksen at online.de
Fri Oct 8 19:49:37 EDT 2010


Thomas DuBuisson wrote:
> On Fri, Oct 8, 2010 at 2:23 PM, Alex Rozenshteyn <rpglover64 at gmail.com>
> wrote:
>> Does there exist a library which allows me to have maps whose elements
>> are maps whose elements ... with a convenient syntax.
> The containers library can do this already - there are no constraints
> on the elements of a Map.  For example:
> 
>> type TripleNestedMap a = Map Int (Map Char (Map String a))
> 
> But this is rather silly as you can just do:
> 
>> type MapOfTriples a = Map (Int ,Char, String) a
> 
> for most uses.

True, but I think this:

>> Alternatively, does there exist a library like Data.Tree where forests
>> are sets rather than lists?

suggests that the OP wants something different, rather like

import Data.Map

data MapTree a
  = Leaf
  | Node (Map a (MapTree a))

I don't know if somebody wrote a library around such a type.

Alex, could you give an example for what would be 'a convenient syntax' for
such a type?
What operations do you think should be available to make using it
convenient?

Cheers
Ben



More information about the Haskell-Cafe mailing list