17 lines
335 B
Haskell
17 lines
335 B
Haskell
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
|
|
edges = Text.unlines . fmap f
|
|
where
|
|
f (x :| xs) = Text.unlines $ (\y -> x <> " -> " <> y <> ";") <$> xs
|