TreeSet.hs
import Data.Tree
import qualified Data.Set as S
branch :: Tree a -> [[a]]
branch Node {rootLabel=n, subForest=[]} = [[n]]
branch Node {rootLabel=n, subForest=f} = map (n:) $ branchF f
where branchF f = concat $ map branch f
powerset :: Ord a => S.Set a -> S.Set (S.Set a)
powerset s
| s == S.empty = S.singleton S.empty
| otherwise = S.map (S.insert x) pxs `S.union` pxs
where (x, xs) = S.deleteFindMin s
pxs = powerset xs
ppowerset s = S.delete s (powerset s)