rubyhs/src/Data/Graphviz.hs

15 lines
327 B
Haskell
Raw Normal View History

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
edges = Text.unlines . fmap ((\(x :| xs) -> Text.unlines $ (\y -> x <> " -> " <> y <> ";") <$> xs))