Created
May 21, 2015 16:40
-
-
Save jagajaga/ae3557ff27e438d67b94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Gshell.Graphs ( | |
) where | |
import Control.Applicative | |
import Data.Graph.Inductive hiding (mkEdges, mkNodes) | |
import Data.GraphViz | |
import Data.GraphViz.Attributes | |
import Data.GraphViz.Attributes.Complete | |
import Data.GraphViz.Printing | |
import Data.Text.Lazy (Text, pack, unpack) | |
import Control.Lens | |
import Data.List | |
import Gshell.State | |
command :: String -> (Text, Shape) | |
command = flip (,) Circle . pack | |
content :: String -> (Text, Shape) | |
content = flip (,) BoxShape . pack | |
{-buildGraph :: GState -> Gr (Text, Shape) Text-} | |
{-buildGraph state = mkGraph nodes edges-} | |
{-where-} | |
{-nodes = mkNodes state-} | |
{-edges = mkEdges state-} | |
mkNodes state = result | |
where | |
result = zipWith (\a b -> (a, content $ state ^. revCommit b)) [1..] $ sortBy cmp $ state ^.. commitsRoot . traverse . _name | |
cmp rev1 rev2 = (state ^. timeStamp rev1) `compare` (state ^. timeStamp rev2) | |
mkEdges = mkEdges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment