1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2025-03-20 04:46:22 +09:00

Implement building discussion message tree from DB

This commit is contained in:
fr33domlover 2016-05-19 12:06:27 +00:00
parent 6d29553844
commit 93aeae36a8
4 changed files with 102 additions and 1 deletions
src/Data/Tree

28
src/Data/Tree/Local.hs Normal file
View file

@ -0,0 +1,28 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-
- The author(s) have dedicated all copyright and related and neighboring
- rights to this software to the public domain worldwide. This software is
- distributed without any warranty.
-
- You should have received a copy of the CC0 Public Domain Dedication along
- with this software. If not, see
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
module Data.Tree.Local
( sortForestOn
)
where
import Prelude
import Data.List (sortOn)
import Data.Tree
sortForestOn :: Ord b => (a -> b) -> Forest a -> Forest a
sortForestOn f =
sortOn (f . rootLabel) . map (\ (Node r s) -> Node r $ sortForestOn f s)