2019-10-16 19:51:47 +00:00
|
|
|
module Data.Graphviz (digraph) where
|
|
|
|
|
|
|
|
import Frelude
|
|
|
|
import qualified Data.Text as Text
|
|
|
|
|
|
|
|
digraph :: [NonEmpty Text] -> Text
|
|
|
|
digraph es = Text.unlines
|
|
|
|
[ "digraph _ {"
|
|
|
|
, edges es
|
|
|
|
, "}"
|
|
|
|
]
|
|
|
|
|
|
|
|
edges :: [NonEmpty Text] -> Text
|
2019-10-17 21:37:56 +00:00
|
|
|
edges = Text.unlines . fmap f
|
|
|
|
where
|
|
|
|
f (x :| xs) = Text.unlines $ (\y -> x <> " -> " <> y <> ";") <$> xs
|