packages feed

rose-trees 0.0.4.2 → 0.0.4.3

raw patch · 5 files changed

+37/−1 lines, 5 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Data.Tree.Hash: fromTree :: (Hashable a, Eq a) => Tree a -> HashTree a
+ Data.Tree.Hash: toTree :: HashTree a -> Tree a
+ Data.Tree.Knuth: fromTree :: Tree a -> KnuthTree a
+ Data.Tree.Knuth: toTree :: KnuthTree a -> Tree a
+ Data.Tree.Knuth.Forest: fromForest :: Forest a -> KnuthForest a
+ Data.Tree.Knuth.Forest: toForest :: KnuthForest a -> Forest a
+ Data.Tree.Set: fromTree :: Ord a => Tree a -> SetTree a
+ Data.Tree.Set: toTree :: SetTree a -> Tree a

Files

rose-trees.cabal view
@@ -1,5 +1,5 @@ Name:                   rose-trees-Version:                0.0.4.2+Version:                0.0.4.3 Author:                 Athan Clark <athan.clark@gmail.com> Maintainer:             Athan Clark <athan.clark@gmail.com> License:                BSD3
src/Data/Tree/Hash.hs view
@@ -13,6 +13,7 @@ import qualified Data.Foldable as F import qualified Data.Maybe    as M import qualified Data.Set.Class as Sets+import qualified Data.Tree      as T import Data.Hashable import Data.Semigroup import Data.Semigroup.Foldable@@ -125,3 +126,10 @@   x' <- p x   pure . HashTree x' . HS.fromList . M.mapMaybe (mapMaybe p)                         . HS.toList $ xs+++toTree :: HashTree a -> T.Tree a+toTree (HashTree x xs) = T.Node x $ toTree <$> HS.toList xs++fromTree :: (Hashable a, Eq a) => T.Tree a -> HashTree a+fromTree (T.Node x xs) = HashTree x . HS.fromList $ fromTree <$> xs
src/Data/Tree/Knuth.hs view
@@ -28,6 +28,7 @@ import Data.Semigroup import Data.Maybe import qualified Data.Set.Class as Sets+import qualified Data.Tree      as T import Control.Monad import Control.DeepSeq @@ -150,3 +151,11 @@     go zss@(KF.Fork x' xc xs)       | xss == fromJust (firstTree zss) = KF.Nil       | otherwise                       = KF.Fork x' (go xc) (go xs)++++toTree :: KnuthTree a -> T.Tree a+toTree (KnuthTree (x,xs)) = T.Node x $ KF.toForest xs++fromTree :: T.Tree a -> KnuthTree a+fromTree (T.Node x xs) = KnuthTree (x, KF.fromForest xs)
src/Data/Tree/Knuth/Forest.hs view
@@ -14,6 +14,7 @@ import Data.Foldable hiding (elem) import Data.Witherable import qualified Data.Set.Class as Sets+import qualified Data.Tree      as T import Control.Applicative import Control.Monad @@ -204,3 +205,13 @@ difference (Fork x xc xs) yss@(Fork y _ _)   | x == y = Nil   | otherwise = Fork x (difference xc yss) (difference xs yss)+++toForest :: KnuthForest a -> T.Forest a+toForest Nil = []+toForest (Fork x xc xs) = (T.Node x (toForest xs)) : toForest xc+++fromForest :: T.Forest a -> KnuthForest a+fromForest [] = Nil+fromForest (T.Node x xs : xss) = Fork x (fromForest xss) (fromForest xs)
src/Data/Tree/Set.hs view
@@ -16,6 +16,7 @@ import Data.Semigroup.Foldable import qualified Data.Set.Class as Sets import Control.Monad+import qualified Data.Tree as T  import Data.Data import GHC.Generics@@ -118,3 +119,10 @@ mapMaybe p (SetTree x xs) = do   x' <- p x   return $ SetTree x' $ Set.fromAscList $ M.mapMaybe (mapMaybe p) $ Set.toAscList xs+++toTree :: SetTree a -> T.Tree a+toTree (SetTree x xs) = T.Node x $ toTree <$> Set.toList xs++fromTree :: Ord a => T.Tree a -> SetTree a+fromTree (T.Node x xs) = SetTree x . Set.fromList $ fromTree <$> xs