Package

purescript-dotlang

Repository
csicar/purescript-dotlang
License
MIT
Uploaded by
csicar
Published on
2022-02-22

documentation can be found on pursuit

define your model like this:

> import Data.DotLang
> import Data.DotLang.Attr (FillStyle(..))
> import Data.DotLang.Attr.Node as Node
> import Data.DotLang.Attr.Edge as Edge
> import Color.Scheme.HTML (red)
> exampleGraph = DiGraph [
      node "a" [ Node.Shape Node.Diamond, Node.Style Filled,  Node.FillColor red ],
      node "b" [],
      "a" ==> "b",
      "a" =*> "d" $ [ Edge.FillColor red ],
      Subgraph [
          node "d" []
      ]
  ]
> -- can be turned into a dotlang using `toText`
> import Data.DotLang.Class (toText)
> toText exampleGraph
"digraph {a [shape=diamond, style=filled, fillcolor=\"#ff0000\"]; b []; a -> b; a -> d [fillcolor=\"#ff0000\"]; subgraph { d []; }}"

Installation

Spago

let additions = 
    { dotlang = 
        { dependencies = 
            [ "colors"
            , "console"
            , "effect"
            , "generics-rep"
            , "prelude"
            , "psci-support"
            , "strings"
            , "test-unit"
            ]
        , repo = "https://github.com/csicar/purescript-dotlang.git"
        , version = "v2.0.0"
        }
    }
spago install dotlang

Bower

bower i purescript-dotlang

v3.0.0

Breaking Changes:

  • Label of Edge and Node now support HTML and no formatting: To migrate replace old calls to Label with calls to label