Proposal: improve the Data.Tree API

Henning Thielemann schlepptop at
Fri Mar 14 08:39:12 UTC 2014

Am 14.03.2014 09:15, schrieb Milan Straka:
> Hi all,
>> -----Original message-----
>> From: João Cristóvão <jmacristovao at>
>> Sent: 2 Mar 2014, 16:47
>> <snip>
>> Consider proposal 3.0.b Milan's idea of splitting forest functions to a
>> different submodule. Milan, could you please elaborate on that? I didn't
>> quite get how they would have the same name...
> The idea was to provide two modules, Data.Tree and Data.Tree.Forest. The
> methods for Forest would be in Data.Tree.Forest. To use the modules, the
> users would write
>    import qualified Data.Tree as Tree
>    import qualified Data.Tree.Forest as Forest
> and then use the methods as
>    Tree.lookupTree
>    Tree.filter
> and
>    Forest.filter

I find this naming scheme attractive. In order to break module cycles I 
usually define private modules. E.g.

Data.Tree.Private exports Tree, but the module is hidden
Data.Tree.Forest imports Tree, exports Forest, module is exposed
Data.Tree imports Tree and Forest, exports Tree, module is exposed

More information about the Libraries mailing list