packages feed

stacked-dag 0.1.0.2 → 0.1.0.3

raw patch · 3 files changed

+29/−4 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ StackedDag.Base: getLongestCommonPrefix :: [String] -> String
+ StackedDag.Base: getLongestCommonPrefix' :: String -> String -> String -> String

Files

ChangeLog.md view
@@ -1,3 +1,5 @@ # Changelog for stacked-dag -## Unreleased changes+## [0.1.0.3] - 2018-09-29+### Changed+- When there is a common prefix of labels, pull out the prefix in front of labels..
src/StackedDag/Base.hs view
@@ -433,6 +433,7 @@ symbolToChar SRMove = '_' symbolToChar SSpace = ' ' + -- | Rendering symbols to text -- -- >>> renderToText [[(SNode "",0)],[(SHold,0)],[(SNode "",0)]] []@@ -441,11 +442,33 @@ -- "o o\n|/\no\n" renderToText :: [[(Symbol,Pos)]] -> [String] -> String renderToText [] _ = []-renderToText ([]:sxx) labelbuf = (if 0 == foldr (\i s -> s + length i) 0 labelbuf  then "" else str )++ "\n" ++ renderToText sxx []+renderToText ([]:sxx) labelbuf = (if 0 == foldr (\i s -> s + length i) 0 labelbuf+                                  then ""+                                  else if len >= 4 && llen >= 2+                                       then str0+                                       else str+                                 )++ "\n" ++ renderToText sxx []   where     str = "    " ++ (L.intercalate "," labelbuf)+    str0 = "    " ++ prefix ++ "{" ++ (L.intercalate "," (map (drop len) labelbuf)) ++ "}"+    prefix = getLongestCommonPrefix labelbuf+    len = length prefix+    llen = length labelbuf+ renderToText ((s@(SNode label,_):sx):sxx) labelbuf = (symbolToChar (fst s)):(renderToText (sx:sxx) (labelbuf ++ [label])) renderToText ((s:sx):sxx) labelbuf = (symbolToChar (fst s)):(renderToText (sx:sxx) labelbuf)++getLongestCommonPrefix' :: String -> String -> String -> String+getLongestCommonPrefix' (x:xs) (y:ys) buf | x == y = getLongestCommonPrefix' xs ys (buf ++ (x:[]))+                                          | otherwise = buf+getLongestCommonPrefix' [] _ buf = buf+getLongestCommonPrefix' _ [] buf = buf+++getLongestCommonPrefix :: [String] -> String+getLongestCommonPrefix (str:strs) = foldl (\a b -> getLongestCommonPrefix' a b []) str strs+getLongestCommonPrefix [] = []+  -- | Allocate destinations of nodes. --
stacked-dag.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 69c513999c24a509f1f35aa177e15003ba58f3377108f1da8396fb38afb3188c+-- hash: d1deae2678881c1a7678ef1c83698157d8a51551cc1989a25a4ba2c3879c63e8  name:           stacked-dag-version:        0.1.0.2+version:        0.1.0.3 synopsis:       Ascii DAG(Directed acyclic graph) for visualization of dataflow description:    Please see the README on GitHub at <https://github.com/junjihashimoto/stacked-dag#readme> category:       Graphs, Graphics