Proposal: Add a catamorphism on Trees

Tikhon Jelvis tikhon at jelv.is
Wed May 18 15:32:49 UTC 2016


I was just thinking about refactoring some code to a tree fold—I had
assumed it was in the library already, and only realized it wasn't when I
saw this thread.

Definite +1.
On May 18, 2016 8:28 AM, <amindfv at gmail.com> wrote:

> +1
>
> Tom
>
>
> El 18 may 2016, a las 08:55, Jake McArthur <jake.mcarthur at gmail.com>
> escribió:
>
> +1 from me as well. I think I'm unlikely to ever turn down a
> straightforward catamorphism or anamorphism.
>
> On Wed, May 18, 2016, 8:52 AM Alp Mestanogullari <alpmestan at gmail.com>
> wrote:
>
>> +1, have implemented it in a few occasions already.
>>
>> On Tue, May 17, 2016 at 11:03 PM, David Feuer <david.feuer at gmail.com>
>> wrote:
>>
>>> Daniel Wagner would like to add the following straightforward function
>>> to Data.Tree. I think this is a grand idea.
>>>
>>> foldTree :: (a -> [b] -> b) -> Tree a -> b
>>> foldTree f = go
>>>   where
>>>     go (Node x ts) = f x (map go ts)
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>>
>>
>>
>>
>> --
>> Alp Mestanogullari
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160518/fd52e560/attachment.html>


More information about the Libraries mailing list