[Haskell-beginners] Tree-like Structure with unique elements on each level

martin martin.drautzburg at web.de
Sat Jan 2 19:53:24 UTC 2016


Hello all,

I recently modeled a tree like this:

data Predicate a = Any | Pred (S.Set a)
data Product a = Pany | Prod (S.Set(Predicate a, S.Set(Product a)))

What I wanted to achieve was to have each element only once on each level. Hence the Sets. But this structure does not
achieve this. I can easily duplicate elements on a level as long as their subordinates are different, so I might as well
give up working with sets.

Is there a way to construct a tree where each element can occur only once on each level?


More information about the Beginners mailing list