hunk ./scons2dot.hs 26 -import qualified Data.ByteString.Char8 as B hunk ./scons2dot.hs 30 -type Elem = B.ByteString +import Data.ByteString.Char8 (ByteString) +import qualified Data.ByteString.Char8 as B + + + +type Elem = ByteString hunk ./scons2dot.hs 41 -lineOk :: B.ByteString -> Bool +lineOk :: ByteString -> Bool hunk ./scons2dot.hs 44 -getLevel :: B.ByteString -> Level +getLevel :: ByteString -> Level hunk ./scons2dot.hs 47 -getElem :: B.ByteString -> Elem +getElem :: ByteString -> Elem hunk ./scons2dot.hs 55 -getProperties :: Int -> B.ByteString -> Properties +getProperties :: Int -> ByteString -> Properties hunk ./scons2dot.hs 71 -lineInfo :: B.ByteString -> (Level, Elem, Properties) +lineInfo :: ByteString -> (Level, Elem, Properties) hunk ./scons2dot.hs 125 -colorProp :: Properties -> B.ByteString +colorProp :: Properties -> ByteString hunk ./scons2dot.hs 130 -otherProp :: Properties -> B.ByteString +otherProp :: Properties -> ByteString hunk ./scons2dot.hs 142 -dotprop :: Properties -> B.ByteString +dotprop :: Properties -> ByteString hunk ./scons2dot.hs 145 -makeDot :: (Set.Set (Elem, Elem), Map.Map Elem Properties) -> B.ByteString +makeDot :: (Set.Set (Elem, Elem), Map.Map Elem Properties) -> ByteString hunk ./scons2dot.hs 148 - dotmap :: (Elem, Elem) -> B.ByteString + dotmap :: (Elem, Elem) -> ByteString hunk ./scons2dot.hs 35 -type Elem = ByteString +newtype Node = Node ByteString deriving (Eq, Ord) hunk ./scons2dot.hs 41 +class BS a where + toBS :: a -> ByteString + frBS :: ByteString -> a + +instance BS Node where + toBS (Node n) = n + frBS = Node + hunk ./scons2dot.hs 55 -getElem :: ByteString -> Elem -getElem = getElemInternal . B.unpack +getNode :: ByteString -> Node +getNode = getNodeInternal . B.unpack hunk ./scons2dot.hs 58 - getElemInternal :: String -> Elem - getElemInternal ('+':'-':cs) = B.pack cs - getElemInternal (_:cs) = getElemInternal cs - getElemInternal [] = error "Unreachable" + getNodeInternal :: String -> Node + getNodeInternal ('+':'-':cs) = Node $ B.pack cs + getNodeInternal (_:cs) = getNodeInternal cs + getNodeInternal [] = error "Unreachable" hunk ./scons2dot.hs 79 -lineInfo :: ByteString -> (Level, Elem, Properties) +lineInfo :: ByteString -> (Level, Node, Properties) hunk ./scons2dot.hs 82 - else (level, getElem str2, getProperties level str) + else (level, getNode str2, getProperties level str) hunk ./scons2dot.hs 90 -buildData :: [(Level, Elem, Properties)] -> (Set.Set (Elem, Elem), Map.Map Elem Properties) +buildData :: [(Level, Node, Properties)] -> (Set.Set (Node, Node), Map.Map Node Properties) hunk ./scons2dot.hs 94 - folder :: ([Elem], Int, [(Elem, Elem, Int, [Elem])], Map.Map Elem Properties) -> (Level, Elem, Properties) -> ([Elem], Int, [(Elem, Elem, Int, [Elem])], Map.Map Elem Properties) + folder :: ([Node], Int, [(Node, Node, Int, [Node])], Map.Map Node Properties) -> (Level, Node, Properties) -> ([Node], Int, [(Node, Node, Int, [Node])], Map.Map Node Properties) hunk ./scons2dot.hs 106 - onlyInteresting :: [(Elem, Elem, Int, [Elem])] -> Set.Set (Elem, Elem) + onlyInteresting :: [(Node, Node, Int, [Node])] -> Set.Set (Node, Node) hunk ./scons2dot.hs 111 -getDescendents :: Elem -> Set.Set (Elem, Elem) -> Set.Set Elem +getDescendents :: Node -> Set.Set (Node, Node) -> Set.Set Node hunk ./scons2dot.hs 118 -getToEliminate :: (Elem, Elem) -> Set.Set (Elem, Elem) -> Set.Set (Elem, Elem) +getToEliminate :: (Node, Node) -> Set.Set (Node, Node) -> Set.Set (Node, Node) hunk ./scons2dot.hs 124 -resumeData :: (Set.Set (Elem, Elem), Map.Map Elem Properties) -> (Set.Set (Elem, Elem), Map.Map Elem Properties) +resumeData :: (Set.Set (Node, Node), Map.Map Node Properties) -> (Set.Set (Node, Node), Map.Map Node Properties) hunk ./scons2dot.hs 128 - folder :: (Elem, Elem) -> Set.Set (Elem, Elem) -> Set.Set (Elem, Elem) + folder :: (Node, Node) -> Set.Set (Node, Node) -> Set.Set (Node, Node) hunk ./scons2dot.hs 130 - del :: (Elem, Elem) -> Set.Set (Elem, Elem) -> Set.Set (Elem, Elem) + del :: (Node, Node) -> Set.Set (Node, Node) -> Set.Set (Node, Node) hunk ./scons2dot.hs 153 -makeDot :: (Set.Set (Elem, Elem), Map.Map Elem Properties) -> ByteString +makeDot :: (Set.Set (Node, Node), Map.Map Node Properties) -> ByteString hunk ./scons2dot.hs 156 - dotmap :: (Elem, Elem) -> ByteString - dotmap (pai, eu) = B.concat [B.pack "\t\"", pai, B.pack "\" -> \"", eu, B.pack "\"\n" ] + dotmap :: (Node, Node) -> ByteString + dotmap (pai, eu) = B.concat [B.pack "\t\"", toBS pai, B.pack "\" -> \"", toBS eu, B.pack "\"\n" ] hunk ./scons2dot.hs 160 - propmap e p str = B.concat [ str, B.pack "\t\"", e, B.pack "\" [ ", dotprop p, B.pack " ]\n" ] + propmap e p str = B.concat [ str, B.pack "\t\"", toBS e, B.pack "\" [ ", dotprop p, B.pack " ]\n" ]