{-# LANGUAGE CPP, OverloadedStrings #-}

{- |
   Module      : Data.GraphViz.Attributes.Complete
   Description : Definition of the Graphviz attributes.
   Copyright   : (c) Matthew Sackman, Ivan Lazar Miljenovic
   License     : 3-Clause BSD-style
   Maintainer  : Ivan.Miljenovic@gmail.com

   If you are just using graphviz to create basic Dot graphs, then you
   probably want to use "Data.GraphViz.Attributes" rather than this
   module.

   This module defines the various attributes that different parts of
   a Graphviz graph can have.  These attributes are based on the
   documentation found at:
     <http://graphviz.org/doc/info/attrs.html>

   For more information on usage, etc. please see that document.

   A summary of known current constraints\/limitations\/differences:

   * Note that for an edge, in /Dot/ parlance if the edge goes from
     /A/ to /B/, then /A/ is the tail node and /B/ is the head node
     (since /A/ is at the tail end of the arrow).

   * @ColorList@, @DoubleList@ and @PointfList@ are defined as actual
     lists (@'LayerList'@ needs a newtype for other reasons).  All of these
     are assumed to be non-empty lists.

   * For the various @*Color@ attributes that take in a list of
     'Color' values, usually only one color is used.  The @Color@
     attribute for edges allows multiple values; for other attributes,
     two values are supported for gradient fills in Graphviz >=
     2.29.0.

   * Style is implemented as a list of 'StyleItem' values; note that
     empty lists are not allowed.

   * A lot of values have a possible value of @none@.  These now
     have custom constructors.  In fact, most constructors have been
     expanded upon to give an idea of what they represent rather than
     using generic terms.

   * 'Rect' uses two 'Point' values to denote the lower-left and
     top-right corners.

   * The two 'LabelLoc' attributes have been combined.

   * @SplineType@ has been replaced with @['Spline']@.

   * Only polygon-based 'Shape's are available.

   * Not every 'Attribute' is fully documented/described.  However,
     all those which have specific allowed values should be covered.

   * Deprecated 'Overlap' algorithms are not defined.  Furthermore,
     the ability to specify an integer prefix for use with the fdp layout
     is /not/ supported.

   * The global @Orientation@ attribute is not defined, as it is
     difficult to distinguish from the node-based 'Orientation'
     'Attribute'; also, its behaviour is duplicated by 'Rotate'.

   * The @charset@ attribute is not available, as graphviz only
     supports UTF-8 encoding (as it is not currently feasible nor needed to
     also support Latin1 encoding).

   * In Graphviz, when a node or edge has a list of attributes, the
     colorscheme which is used to identify a color can be set /after/
     that color (e.g. @[colorscheme=x11,color=grey,colorscheme=svg]@
     uses the svg colorscheme's definition of grey, which is different
     from the x11 one.  Instead, graphviz parses them in order.

 -}
module Data.GraphViz.Attributes.Complete
       ( -- * The actual /Dot/ attributes.
         -- $attributes
         Attribute(..)
       , Attributes
       , sameAttribute
       , defaultAttributeValue
       , rmUnwantedAttributes
         -- ** Validity functions on @Attribute@ values.
       , usedByGraphs
       , usedBySubGraphs
       , usedByClusters
       , usedByNodes
       , usedByEdges
       , validUnknown

         -- ** Custom attributes.
       , AttributeName
       , CustomAttribute
       , customAttribute
       , isCustom
       , isSpecifiedCustom
       , customValue
       , customName
       , findCustoms
       , findSpecifiedCustom
       , deleteCustomAttributes
       , deleteSpecifiedCustom

         -- * Value types for @Attribute@s.
       , module Data.GraphViz.Attributes.Colors

         -- ** Generic types
       , Number (..)

         -- ** Labels
       , EscString
       , Label(..)
       , VerticalPlacement(..)
       , LabelScheme(..)
       , SVGFontNames(..)
         -- *** Types representing the Dot grammar for records.
       , RecordFields
       , RecordField(..)
       , Rect(..)
       , Justification(..)

         -- ** Nodes
       , Shape(..)
       , Paths(..)
       , ScaleType(..)
       , NodeSize(..)

         -- ** Edges
       , DirType(..)
       , EdgeType(..)
         -- *** Modifying where edges point
       , PortName(..)
       , PortPos(..)
       , CompassPoint(..)
         -- *** Arrows
       , ArrowType(..)
       , ArrowShape(..)
       , ArrowModifier(..)
       , ArrowFill(..)
       , ArrowSide(..)
         -- **** @ArrowModifier@ values
       , noMods
       , openMod

         -- ** Positioning
       , Point(..)
       , createPoint
       , Pos(..)
       , Spline(..)
       , DPoint(..)
       , Normalized (..)

         -- ** Layout
       , GraphvizCommand(..)
       , GraphSize(..)
       , ClusterMode(..)
       , Model(..)
       , Overlap(..)
       , Root(..)
       , Order(..)
       , OutputMode(..)
       , Pack(..)
       , PackMode(..)
       , PageDir(..)
       , QuadType(..)
       , RankType(..)
       , RankDir(..)
       , StartType(..)
       , ViewPort(..)
       , FocusType(..)
       , Ratios(..)

         -- ** Modes
       , ModeType(..)
       , DEConstraints(..)

         -- ** Layers
       , LayerSep(..)
       , LayerListSep(..)
       , LayerRange
       , LayerRangeElem(..)
       , LayerID(..)
       , LayerList(..)

         -- ** Stylistic
       , SmoothType(..)
       , STStyle(..)
       , StyleItem(..)
       , StyleName(..)
       ) where

import Data.GraphViz.Attributes.Arrows
import Data.GraphViz.Attributes.Colors
import Data.GraphViz.Attributes.Colors.X11 (X11Color(Black))
import Data.GraphViz.Attributes.Internal
import Data.GraphViz.Attributes.Values
import Data.GraphViz.Commands.Available
import Data.GraphViz.Exception             (GraphvizException(NotCustomAttr),
                                            throw)
import Data.GraphViz.Internal.State        (getsGS, parseStrictly)
import Data.GraphViz.Internal.Util         (bool, isIDString, keywords,
                                            restIDString)
import Data.GraphViz.Parsing
import Data.GraphViz.Printing

import           Data.List      (partition)
import           Data.Maybe     (isNothing)
import qualified Data.Set       as S
import           Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import           Data.Version   (Version(..))
import           Data.Word      (Word16)

#if !MIN_VERSION_base (4,13,0)
import Data.Monoid ((<>))
#endif

-- -----------------------------------------------------------------------------

{- $attributes

   These attributes have been implemented in a /permissive/ manner:
   that is, rather than split them up based on which type of value
   they are allowed, they have all been included in the one data type,
   with functions to determine if they are indeed valid for what
   they're being applied to.

   To interpret the /Valid for/ listings:

     [@G@] Valid for Graphs.

     [@C@] Valid for Clusters.

     [@S@] Valid for Sub-Graphs (and also Clusters).

     [@N@] Valid for Nodes.

     [@E@] Valid for Edges.

   The /Default/ listings are those that the various Graphviz commands
   use if that 'Attribute' isn't specified (in cases where this is
   /none/, this is equivalent to a 'Nothing' value; that is, no value
   is used).  The /Parsing Default/ listings represent what value is
   used (i.e. corresponds to 'True') when the 'Attribute' name is
   listed on its own in /Dot/ source code.

   Please note that the 'UnknownAttribute' 'Attribute' is defined
   primarily for backwards-compatibility purposes.  It is possible to use
   it directly for custom purposes; for more information, please see
   'CustomAttribute'.  The 'deleteCustomAttributes' can be used to delete
   these values.

 -}

-- | Attributes are used to customise the layout and design of Dot
--   graphs.  Care must be taken to ensure that the attribute you use
--   is valid, as not all attributes can be used everywhere.
data Attribute
  = Damping Double                      -- ^ /Valid for/: G; /Default/: @0.99@; /Minimum/: @0.0@; /Notes/: 'Neato' only
  | K Double                            -- ^ /Valid for/: GC; /Default/: @0.3@; /Minimum/: @0@; /Notes/: 'Sfdp', 'Fdp' only
  | URL EscString                       -- ^ /Valid for/: ENGC; /Default/: none; /Notes/: svg, postscript, map only
  | Area Double                         -- ^ /Valid for/: NC; /Default/: @1.0@; /Minimum/: @>0@; /Notes/: 'Patchwork' only, requires Graphviz >= 2.30.0
  | ArrowHead ArrowType                 -- ^ /Valid for/: E; /Default/: @'normal'@
  | ArrowSize Double                    -- ^ /Valid for/: E; /Default/: @1.0@; /Minimum/: @0.0@
  | ArrowTail ArrowType                 -- ^ /Valid for/: E; /Default/: @'normal'@
  | Background Text                     -- ^ /Valid for/: G; /Default/: none; /Notes/: xdot only
  | BoundingBox Rect                    -- ^ /Valid for/: G; /Notes/: write only
  | BgColor ColorList                   -- ^ /Valid for/: GC; /Default/: @[]@
  | Center Bool                         -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'
  | ClusterRank ClusterMode             -- ^ /Valid for/: G; /Default/: @'Local'@; /Notes/: 'Dot' only
  | Color ColorList                     -- ^ /Valid for/: ENC; /Default/: @['WC' ('X11Color' 'Black') Nothing]@
  | ColorScheme ColorScheme             -- ^ /Valid for/: ENCG; /Default/: @'X11'@
  | Comment Text                        -- ^ /Valid for/: ENG; /Default/: @\"\"@
  | Compound Bool                       -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'; /Notes/: 'Dot' only
  | Concentrate Bool                    -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'
  | Constraint Bool                     -- ^ /Valid for/: E; /Default/: @'True'@; /Parsing Default/: 'True'; /Notes/: 'Dot' only
  | Decorate Bool                       -- ^ /Valid for/: E; /Default/: @'False'@; /Parsing Default/: 'True'
  | DefaultDist Double                  -- ^ /Valid for/: G; /Default/: @1+(avg. len)*sqrt(abs(V))@ (unable to statically define); /Minimum/: The value of 'Epsilon'.; /Notes/: 'Neato' only, only if @'Pack' 'DontPack'@
  | Dim Int                             -- ^ /Valid for/: G; /Default/: @2@; /Minimum/: @2@; /Notes/: maximum of @10@; 'Sfdp', 'Fdp', 'Neato' only
  | Dimen Int                           -- ^ /Valid for/: G; /Default/: @2@; /Minimum/: @2@; /Notes/: maximum of @10@; 'Sfdp', 'Fdp', 'Neato' only
  | Dir DirType                         -- ^ /Valid for/: E; /Default/: @'Forward'@ (directed), @'NoDir'@ (undirected)
  | DirEdgeConstraints DEConstraints    -- ^ /Valid for/: G; /Default/: @'NoConstraints'@; /Parsing Default/: 'EdgeConstraints'; /Notes/: 'Neato' only
  | Distortion Double                   -- ^ /Valid for/: N; /Default/: @0.0@; /Minimum/: @-100.0@
  | DPI Double                          -- ^ /Valid for/: G; /Default/: @96.0@, @0.0@; /Notes/: svg, bitmap output only; \"resolution\" is a synonym
  | EdgeURL EscString                   -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, map only
  | EdgeTarget EscString                -- ^ /Valid for/: E; /Default/: none; /Notes/: svg, map only
  | EdgeTooltip EscString               -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, cmap only
  | Epsilon Double                      -- ^ /Valid for/: G; /Default/: @.0001 * # nodes@ (@mode == 'KK'@), @.0001@ (@mode == 'Major'@); /Notes/: 'Neato' only
  | ESep DPoint                         -- ^ /Valid for/: G; /Default/: @'DVal' 3@; /Notes/: not 'Dot'
  | FillColor ColorList                 -- ^ /Valid for/: NEC; /Default/: @['WC' ('X11Color' 'LightGray') Nothing]@ (nodes), @['WC' ('X11Color' 'Black') Nothing]@ (clusters)
  | FixedSize NodeSize                  -- ^ /Valid for/: N; /Default/: @'GrowAsNeeded'@; /Parsing Default/: 'SetNodeSize'
  | FontColor Color                     -- ^ /Valid for/: ENGC; /Default/: @'X11Color' 'Black'@
  | FontName Text                       -- ^ /Valid for/: ENGC; /Default/: @\"Times-Roman\"@
  | FontNames SVGFontNames              -- ^ /Valid for/: G; /Default/: @'SvgNames'@; /Notes/: svg only
  | FontPath Paths                      -- ^ /Valid for/: G; /Default/: system dependent
  | FontSize Double                     -- ^ /Valid for/: ENGC; /Default/: @14.0@; /Minimum/: @1.0@
  | ForceLabels Bool                    -- ^ /Valid for/: G; /Default/: @'True'@; /Parsing Default/: 'True'; /Notes/: only for 'XLabel' attributes, requires Graphviz >= 2.29.0
  | GradientAngle Int                   -- ^ /Valid for/: NCG; /Default/: 0; /Notes/: requires Graphviz >= 2.29.0
  | Group Text                          -- ^ /Valid for/: N; /Default/: @\"\"@; /Notes/: 'Dot' only
  | HeadURL EscString                   -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, map only
  | Head_LP Point                       -- ^ /Valid for/: E; /Notes/: write only, requires Graphviz >= 2.30.0
  | HeadClip Bool                       -- ^ /Valid for/: E; /Default/: @'True'@; /Parsing Default/: 'True'
  | HeadLabel Label                     -- ^ /Valid for/: E; /Default/: @'StrLabel' \"\"@
  | HeadPort PortPos                    -- ^ /Valid for/: E; /Default/: @'CompassPoint' 'CenterPoint'@
  | HeadTarget EscString                -- ^ /Valid for/: E; /Default/: none; /Notes/: svg, map only
  | HeadTooltip EscString               -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, cmap only
  | Height Double                       -- ^ /Valid for/: N; /Default/: @0.5@; /Minimum/: @0.02@
  | ID EscString                        -- ^ /Valid for/: GNE; /Default/: @\"\"@; /Notes/: svg, postscript, map only
  | Image Text                          -- ^ /Valid for/: N; /Default/: @\"\"@
  | ImagePath Paths                     -- ^ /Valid for/: G; /Default/: @'Paths' []@; /Notes/: Printing and parsing is OS-specific, requires Graphviz >= 2.29.0
  | ImageScale ScaleType                -- ^ /Valid for/: N; /Default/: @'NoScale'@; /Parsing Default/: 'UniformScale'
  | InputScale Double                   -- ^ /Valid for/: N; /Default/: none; /Notes/: 'Fdp', 'Neato' only, a value of @0@ is equivalent to being @72@, requires Graphviz >= 2.36.0
  | Label Label                         -- ^ /Valid for/: ENGC; /Default/: @'StrLabel' \"\\N\"@ (nodes), @'StrLabel' \"\"@ (otherwise)
  | LabelURL EscString                  -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, map only
  | LabelScheme LabelScheme             -- ^ /Valid for/: G; /Default/: @'NotEdgeLabel'@; /Notes/: 'Sfdp' only, requires Graphviz >= 2.28.0
  | LabelAngle Double                   -- ^ /Valid for/: E; /Default/: @-25.0@; /Minimum/: @-180.0@
  | LabelDistance Double                -- ^ /Valid for/: E; /Default/: @1.0@; /Minimum/: @0.0@
  | LabelFloat Bool                     -- ^ /Valid for/: E; /Default/: @'False'@; /Parsing Default/: 'True'
  | LabelFontColor Color                -- ^ /Valid for/: E; /Default/: @'X11Color' 'Black'@
  | LabelFontName Text                  -- ^ /Valid for/: E; /Default/: @\"Times-Roman\"@
  | LabelFontSize Double                -- ^ /Valid for/: E; /Default/: @14.0@; /Minimum/: @1.0@
  | LabelJust Justification             -- ^ /Valid for/: GC; /Default/: @'JCenter'@
  | LabelLoc VerticalPlacement          -- ^ /Valid for/: GCN; /Default/: @'VTop'@ (clusters), @'VBottom'@ (root graphs), @'VCenter'@ (nodes)
  | LabelTarget EscString               -- ^ /Valid for/: E; /Default/: none; /Notes/: svg, map only
  | LabelTooltip EscString              -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, cmap only
  | Landscape Bool                      -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'
  | Layer LayerRange                    -- ^ /Valid for/: ENC; /Default/: @[]@
  | LayerListSep LayerListSep           -- ^ /Valid for/: G; /Default/: @'LLSep' \",\"@; /Notes/: requires Graphviz >= 2.30.0
  | Layers LayerList                    -- ^ /Valid for/: G; /Default/: @'LL' []@
  | LayerSelect LayerRange              -- ^ /Valid for/: G; /Default/: @[]@
  | LayerSep LayerSep                   -- ^ /Valid for/: G; /Default/: @'LSep' \" :\t\"@
  | Layout GraphvizCommand              -- ^ /Valid for/: G
  | Len Double                          -- ^ /Valid for/: E; /Default/: @1.0@ ('Neato'), @0.3@ ('Fdp'); /Notes/: 'Fdp', 'Neato' only
  | Levels Int                          -- ^ /Valid for/: G; /Default/: @'maxBound'@; /Minimum/: @0@; /Notes/: 'Sfdp' only
  | LevelsGap Double                    -- ^ /Valid for/: G; /Default/: @0.0@; /Notes/: 'Neato' only
  | LHead Text                          -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: 'Dot' only
  | LHeight Double                      -- ^ /Valid for/: GC; /Notes/: write only, requires Graphviz >= 2.28.0
  | LPos Point                          -- ^ /Valid for/: EGC; /Notes/: write only
  | LTail Text                          -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: 'Dot' only
  | LWidth Double                       -- ^ /Valid for/: GC; /Notes/: write only, requires Graphviz >= 2.28.0
  | Margin DPoint                       -- ^ /Valid for/: NGC; /Default/: device dependent
  | MaxIter Int                         -- ^ /Valid for/: G; /Default/: @100 * # nodes@ (@mode == 'KK'@), @200@ (@mode == 'Major'@), @600@ ('Fdp'); /Notes/: 'Fdp', 'Neato' only
  | MCLimit Double                      -- ^ /Valid for/: G; /Default/: @1.0@; /Notes/: 'Dot' only
  | MinDist Double                      -- ^ /Valid for/: G; /Default/: @1.0@; /Minimum/: @0.0@; /Notes/: 'Circo' only
  | MinLen Int                          -- ^ /Valid for/: E; /Default/: @1@; /Minimum/: @0@; /Notes/: 'Dot' only
  | Mode ModeType                       -- ^ /Valid for/: G; /Default/: @'Major'@ (actually @'Spring'@ for 'Sfdp', but this isn't used as a default in this library); /Notes/: 'Neato', 'Sfdp' only
  | Model Model                         -- ^ /Valid for/: G; /Default/: @'ShortPath'@; /Notes/: 'Neato' only
  | Mosek Bool                          -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'; /Notes/: 'Neato' only; requires the Mosek software
  | NodeSep Double                      -- ^ /Valid for/: G; /Default/: @0.25@; /Minimum/: @0.02@
  | NoJustify Bool                      -- ^ /Valid for/: GCNE; /Default/: @'False'@; /Parsing Default/: 'True'
  | Normalize Normalized                -- ^ /Valid for/: G; /Default/: @'NotNormalized'@; /Parsing Default/: 'IsNormalized'; /Notes/: not 'Dot'
  | NoTranslate Bool                    -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'; /Notes/: 'Neato' only, requires Graphviz >= 2.38.0
  | Nslimit Double                      -- ^ /Valid for/: G; /Notes/: 'Dot' only
  | Nslimit1 Double                     -- ^ /Valid for/: G; /Notes/: 'Dot' only
  | Ordering Order                      -- ^ /Valid for/: GN; /Default/: none; /Notes/: 'Dot' only
  | Orientation Double                  -- ^ /Valid for/: N; /Default/: @0.0@; /Minimum/: @360.0@
  | OutputOrder OutputMode              -- ^ /Valid for/: G; /Default/: @'BreadthFirst'@
  | Overlap Overlap                     -- ^ /Valid for/: G; /Default/: @'KeepOverlaps'@; /Parsing Default/: 'KeepOverlaps'; /Notes/: not 'Dot'
  | OverlapScaling Double               -- ^ /Valid for/: G; /Default/: @-4@; /Minimum/: @-1.0e10@; /Notes/: 'PrismOverlap' only
  | OverlapShrink Bool                  -- ^ /Valid for/: G; /Default/: @'True'@; /Parsing Default/: 'True'; /Notes/: 'PrismOverlap' only, requires Graphviz >= 2.36.0
  | Pack Pack                           -- ^ /Valid for/: G; /Default/: @'DontPack'@; /Parsing Default/: 'DoPack'
  | PackMode PackMode                   -- ^ /Valid for/: G; /Default/: @'PackNode'@
  | Pad DPoint                          -- ^ /Valid for/: G; /Default/: @'DVal' 0.0555@ (4 points)
  | Page Point                          -- ^ /Valid for/: G
  | PageDir PageDir                     -- ^ /Valid for/: G; /Default/: @'Bl'@
  | PenColor Color                      -- ^ /Valid for/: C; /Default/: @'X11Color' 'Black'@
  | PenWidth Double                     -- ^ /Valid for/: CNE; /Default/: @1.0@; /Minimum/: @0.0@
  | Peripheries Int                     -- ^ /Valid for/: NC; /Default/: shape default (nodes), @1@ (clusters); /Minimum/: 0
  | Pin Bool                            -- ^ /Valid for/: N; /Default/: @'False'@; /Parsing Default/: 'True'; /Notes/: 'Fdp', 'Neato' only
  | Pos Pos                             -- ^ /Valid for/: EN
  | QuadTree QuadType                   -- ^ /Valid for/: G; /Default/: @'NormalQT'@; /Parsing Default/: 'NormalQT'; /Notes/: 'Sfdp' only
  | Quantum Double                      -- ^ /Valid for/: G; /Default/: @0.0@; /Minimum/: @0.0@
  | Rank RankType                       -- ^ /Valid for/: S; /Notes/: 'Dot' only
  | RankDir RankDir                     -- ^ /Valid for/: G; /Default/: @'FromTop'@; /Notes/: 'Dot' only
  | RankSep [Double]                    -- ^ /Valid for/: G; /Default/: @[0.5]@ ('Dot'), @[1.0]@ ('Twopi'); /Minimum/: @[0.02]@; /Notes/: 'Twopi', 'Dot' only
  | Ratio Ratios                        -- ^ /Valid for/: G
  | Rects [Rect]                        -- ^ /Valid for/: N; /Notes/: write only
  | Regular Bool                        -- ^ /Valid for/: N; /Default/: @'False'@; /Parsing Default/: 'True'
  | ReMinCross Bool                     -- ^ /Valid for/: G; /Default/: @'False'@; /Parsing Default/: 'True'; /Notes/: 'Dot' only
  | RepulsiveForce Double               -- ^ /Valid for/: G; /Default/: @1.0@; /Minimum/: @0.0@; /Notes/: 'Sfdp' only
  | Root Root                           -- ^ /Valid for/: GN; /Default/: @'NodeName' \"\"@ (graphs), @'NotCentral'@ (nodes); /Parsing Default/: 'IsCentral'; /Notes/: 'Circo', 'Twopi' only
  | Rotate Int                          -- ^ /Valid for/: G; /Default/: @0@
  | Rotation Double                     -- ^ /Valid for/: G; /Default/: @0@; /Notes/: 'Sfdp' only, requires Graphviz >= 2.28.0
  | SameHead Text                       -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: 'Dot' only
  | SameTail Text                       -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: 'Dot' only
  | SamplePoints Int                    -- ^ /Valid for/: N; /Default/: @8@ (output), @20@ (overlap and image maps)
  | Scale DPoint                        -- ^ /Valid for/: G; /Notes/: Not 'Dot', requires Graphviz >= 2.28.0 (>= 2.38.0 for anything except 'TwoPi')
  | SearchSize Int                      -- ^ /Valid for/: G; /Default/: @30@; /Notes/: 'Dot' only
  | Sep DPoint                          -- ^ /Valid for/: G; /Default/: @'DVal' 4@; /Notes/: not 'Dot'
  | Shape Shape                         -- ^ /Valid for/: N; /Default/: @'Ellipse'@
  | ShowBoxes Int                       -- ^ /Valid for/: ENG; /Default/: @0@; /Minimum/: @0@; /Notes/: 'Dot' only; used for debugging by printing PostScript guide boxes
  | Sides Int                           -- ^ /Valid for/: N; /Default/: @4@; /Minimum/: @0@
  | Size GraphSize                      -- ^ /Valid for/: G
  | Skew Double                         -- ^ /Valid for/: N; /Default/: @0.0@; /Minimum/: @-100.0@
  | Smoothing SmoothType                -- ^ /Valid for/: G; /Default/: @'NoSmooth'@; /Notes/: 'Sfdp' only
  | SortV Word16                        -- ^ /Valid for/: GCN; /Default/: @0@; /Minimum/: @0@
  | Splines EdgeType                    -- ^ /Valid for/: G; /Default/: @'SplineEdges'@ ('Dot'), @'LineEdges'@ (other); /Parsing Default/: 'SplineEdges'
  | Start StartType                     -- ^ /Valid for/: G; /Default/: @'StartStyleSeed' 'RandomStyle' seed@ for some unknown fixed seed.; /Notes/: 'Fdp', 'Neato' only
  | Style [StyleItem]                   -- ^ /Valid for/: ENCG
  | StyleSheet Text                     -- ^ /Valid for/: G; /Default/: @\"\"@; /Notes/: svg only
  | TailURL EscString                   -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, map only
  | Tail_LP Point                       -- ^ /Valid for/: E; /Notes/: write only, requires Graphviz >= 2.30.0
  | TailClip Bool                       -- ^ /Valid for/: E; /Default/: @'True'@; /Parsing Default/: 'True'
  | TailLabel Label                     -- ^ /Valid for/: E; /Default/: @'StrLabel' \"\"@
  | TailPort PortPos                    -- ^ /Valid for/: E; /Default/: @'CompassPoint' 'CenterPoint'@
  | TailTarget EscString                -- ^ /Valid for/: E; /Default/: none; /Notes/: svg, map only
  | TailTooltip EscString               -- ^ /Valid for/: E; /Default/: @\"\"@; /Notes/: svg, cmap only
  | Target EscString                    -- ^ /Valid for/: ENGC; /Default/: none; /Notes/: svg, map only
  | Tooltip EscString                   -- ^ /Valid for/: NEC; /Default/: @\"\"@; /Notes/: svg, cmap only
  | TrueColor Bool                      -- ^ /Valid for/: G; /Parsing Default/: 'True'; /Notes/: bitmap output only
  | Vertices [Point]                    -- ^ /Valid for/: N; /Notes/: write only
  | ViewPort ViewPort                   -- ^ /Valid for/: G; /Default/: none
  | VoroMargin Double                   -- ^ /Valid for/: G; /Default/: @0.05@; /Minimum/: @0.0@; /Notes/: not 'Dot'
  | Weight Number                       -- ^ /Valid for/: E; /Default/: @'Int' 1@; /Minimum/: @'Int' 0@ ('Dot'), @'Int' 1@ ('Neato','Fdp','Sfdp'); /Notes/: as of Graphviz 2.30: weights for dot need to be 'Int's
  | Width Double                        -- ^ /Valid for/: N; /Default/: @0.75@; /Minimum/: @0.01@
  | XDotVersion Version                 -- ^ /Valid for/: G; /Notes/: xdot only, requires Graphviz >= 2.34.0, equivalent to specifying version of xdot to be used
  | XLabel Label                        -- ^ /Valid for/: EN; /Default/: @'StrLabel' \"\"@; /Notes/: requires Graphviz >= 2.29.0
  | XLP Point                           -- ^ /Valid for/: EN; /Notes/: write only, requires Graphviz >= 2.29.0
  | UnknownAttribute AttributeName Text -- ^ /Valid for/: Assumed valid for all; the fields are 'Attribute' name and value respectively.
  deriving (Attribute -> Attribute -> Bool
(Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool) -> Eq Attribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c== :: Attribute -> Attribute -> Bool
Eq, Eq Attribute
Eq Attribute =>
(Attribute -> Attribute -> Ordering)
-> (Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Attribute)
-> (Attribute -> Attribute -> Attribute)
-> Ord Attribute
Attribute -> Attribute -> Bool
Attribute -> Attribute -> Ordering
Attribute -> Attribute -> Attribute
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Attribute -> Attribute -> Attribute
$cmin :: Attribute -> Attribute -> Attribute
max :: Attribute -> Attribute -> Attribute
$cmax :: Attribute -> Attribute -> Attribute
>= :: Attribute -> Attribute -> Bool
$c>= :: Attribute -> Attribute -> Bool
> :: Attribute -> Attribute -> Bool
$c> :: Attribute -> Attribute -> Bool
<= :: Attribute -> Attribute -> Bool
$c<= :: Attribute -> Attribute -> Bool
< :: Attribute -> Attribute -> Bool
$c< :: Attribute -> Attribute -> Bool
compare :: Attribute -> Attribute -> Ordering
$ccompare :: Attribute -> Attribute -> Ordering
$cp1Ord :: Eq Attribute
Ord, Int -> Attribute -> ShowS
[Attribute] -> ShowS
Attribute -> String
(Int -> Attribute -> ShowS)
-> (Attribute -> String)
-> ([Attribute] -> ShowS)
-> Show Attribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attribute] -> ShowS
$cshowList :: [Attribute] -> ShowS
show :: Attribute -> String
$cshow :: Attribute -> String
showsPrec :: Int -> Attribute -> ShowS
$cshowsPrec :: Int -> Attribute -> ShowS
Show, ReadPrec [Attribute]
ReadPrec Attribute
Int -> ReadS Attribute
ReadS [Attribute]
(Int -> ReadS Attribute)
-> ReadS [Attribute]
-> ReadPrec Attribute
-> ReadPrec [Attribute]
-> Read Attribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Attribute]
$creadListPrec :: ReadPrec [Attribute]
readPrec :: ReadPrec Attribute
$creadPrec :: ReadPrec Attribute
readList :: ReadS [Attribute]
$creadList :: ReadS [Attribute]
readsPrec :: Int -> ReadS Attribute
$creadsPrec :: Int -> ReadS Attribute
Read)

type Attributes = [Attribute]

-- | The name for an UnknownAttribute; must satisfy  'validUnknown'.
type AttributeName = Text

instance PrintDot Attribute where
  unqtDot :: Attribute -> DotCode
unqtDot (Damping v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "Damping" Double
v
  unqtDot (K v :: Double
v)                  = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "K" Double
v
  unqtDot (URL v :: Text
v)                = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "URL" Text
v
  unqtDot (Area v :: Double
v)               = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "area" Double
v
  unqtDot (ArrowHead v :: ArrowType
v)          = Text -> ArrowType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "arrowhead" ArrowType
v
  unqtDot (ArrowSize v :: Double
v)          = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "arrowsize" Double
v
  unqtDot (ArrowTail v :: ArrowType
v)          = Text -> ArrowType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "arrowtail" ArrowType
v
  unqtDot (Background v :: Text
v)         = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "_background" Text
v
  unqtDot (BoundingBox v :: Rect
v)        = Text -> Rect -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "bb" Rect
v
  unqtDot (BgColor v :: ColorList
v)            = Text -> ColorList -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "bgcolor" ColorList
v
  unqtDot (Center v :: Bool
v)             = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "center" Bool
v
  unqtDot (ClusterRank v :: ClusterMode
v)        = Text -> ClusterMode -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "clusterrank" ClusterMode
v
  unqtDot (Color v :: ColorList
v)              = Text -> ColorList -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "color" ColorList
v
  unqtDot (ColorScheme v :: ColorScheme
v)        = Text -> ColorScheme -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "colorscheme" ColorScheme
v
  unqtDot (Comment v :: Text
v)            = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "comment" Text
v
  unqtDot (Compound v :: Bool
v)           = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "compound" Bool
v
  unqtDot (Concentrate v :: Bool
v)        = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "concentrate" Bool
v
  unqtDot (Constraint v :: Bool
v)         = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "constraint" Bool
v
  unqtDot (Decorate v :: Bool
v)           = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "decorate" Bool
v
  unqtDot (DefaultDist v :: Double
v)        = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "defaultdist" Double
v
  unqtDot (Dim v :: Int
v)                = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "dim" Int
v
  unqtDot (Dimen v :: Int
v)              = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "dimen" Int
v
  unqtDot (Dir v :: DirType
v)                = Text -> DirType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "dir" DirType
v
  unqtDot (DirEdgeConstraints v :: DEConstraints
v) = Text -> DEConstraints -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "diredgeconstraints" DEConstraints
v
  unqtDot (Distortion v :: Double
v)         = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "distortion" Double
v
  unqtDot (DPI v :: Double
v)                = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "dpi" Double
v
  unqtDot (EdgeURL v :: Text
v)            = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "edgeURL" Text
v
  unqtDot (EdgeTarget v :: Text
v)         = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "edgetarget" Text
v
  unqtDot (EdgeTooltip v :: Text
v)        = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "edgetooltip" Text
v
  unqtDot (Epsilon v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "epsilon" Double
v
  unqtDot (ESep v :: DPoint
v)               = Text -> DPoint -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "esep" DPoint
v
  unqtDot (FillColor v :: ColorList
v)          = Text -> ColorList -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fillcolor" ColorList
v
  unqtDot (FixedSize v :: NodeSize
v)          = Text -> NodeSize -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fixedsize" NodeSize
v
  unqtDot (FontColor v :: Color
v)          = Text -> Color -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fontcolor" Color
v
  unqtDot (FontName v :: Text
v)           = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fontname" Text
v
  unqtDot (FontNames v :: SVGFontNames
v)          = Text -> SVGFontNames -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fontnames" SVGFontNames
v
  unqtDot (FontPath v :: Paths
v)           = Text -> Paths -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fontpath" Paths
v
  unqtDot (FontSize v :: Double
v)           = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "fontsize" Double
v
  unqtDot (ForceLabels v :: Bool
v)        = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "forcelabels" Bool
v
  unqtDot (GradientAngle v :: Int
v)      = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "gradientangle" Int
v
  unqtDot (Group v :: Text
v)              = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "group" Text
v
  unqtDot (HeadURL v :: Text
v)            = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headURL" Text
v
  unqtDot (Head_LP v :: Point
v)            = Text -> Point -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "head_lp" Point
v
  unqtDot (HeadClip v :: Bool
v)           = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headclip" Bool
v
  unqtDot (HeadLabel v :: Label
v)          = Text -> Label -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headlabel" Label
v
  unqtDot (HeadPort v :: PortPos
v)           = Text -> PortPos -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headport" PortPos
v
  unqtDot (HeadTarget v :: Text
v)         = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headtarget" Text
v
  unqtDot (HeadTooltip v :: Text
v)        = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "headtooltip" Text
v
  unqtDot (Height v :: Double
v)             = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "height" Double
v
  unqtDot (ID v :: Text
v)                 = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "id" Text
v
  unqtDot (Image v :: Text
v)              = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "image" Text
v
  unqtDot (ImagePath v :: Paths
v)          = Text -> Paths -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "imagepath" Paths
v
  unqtDot (ImageScale v :: ScaleType
v)         = Text -> ScaleType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "imagescale" ScaleType
v
  unqtDot (InputScale v :: Double
v)         = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "inputscale" Double
v
  unqtDot (Label v :: Label
v)              = Text -> Label -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "label" Label
v
  unqtDot (LabelURL v :: Text
v)           = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelURL" Text
v
  unqtDot (LabelScheme v :: LabelScheme
v)        = Text -> LabelScheme -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "label_scheme" LabelScheme
v
  unqtDot (LabelAngle v :: Double
v)         = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelangle" Double
v
  unqtDot (LabelDistance v :: Double
v)      = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labeldistance" Double
v
  unqtDot (LabelFloat v :: Bool
v)         = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelfloat" Bool
v
  unqtDot (LabelFontColor v :: Color
v)     = Text -> Color -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelfontcolor" Color
v
  unqtDot (LabelFontName v :: Text
v)      = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelfontname" Text
v
  unqtDot (LabelFontSize v :: Double
v)      = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelfontsize" Double
v
  unqtDot (LabelJust v :: Justification
v)          = Text -> Justification -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labeljust" Justification
v
  unqtDot (LabelLoc v :: VerticalPlacement
v)           = Text -> VerticalPlacement -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labelloc" VerticalPlacement
v
  unqtDot (LabelTarget v :: Text
v)        = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labeltarget" Text
v
  unqtDot (LabelTooltip v :: Text
v)       = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "labeltooltip" Text
v
  unqtDot (Landscape v :: Bool
v)          = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "landscape" Bool
v
  unqtDot (Layer v :: LayerRange
v)              = Text -> LayerRange -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layer" LayerRange
v
  unqtDot (LayerListSep v :: LayerListSep
v)       = Text -> LayerListSep -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layerlistsep" LayerListSep
v
  unqtDot (Layers v :: LayerList
v)             = Text -> LayerList -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layers" LayerList
v
  unqtDot (LayerSelect v :: LayerRange
v)        = Text -> LayerRange -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layerselect" LayerRange
v
  unqtDot (LayerSep v :: LayerSep
v)           = Text -> LayerSep -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layersep" LayerSep
v
  unqtDot (Layout v :: GraphvizCommand
v)             = Text -> GraphvizCommand -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "layout" GraphvizCommand
v
  unqtDot (Len v :: Double
v)                = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "len" Double
v
  unqtDot (Levels v :: Int
v)             = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "levels" Int
v
  unqtDot (LevelsGap v :: Double
v)          = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "levelsgap" Double
v
  unqtDot (LHead v :: Text
v)              = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "lhead" Text
v
  unqtDot (LHeight v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "LHeight" Double
v
  unqtDot (LPos v :: Point
v)               = Text -> Point -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "lp" Point
v
  unqtDot (LTail v :: Text
v)              = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "ltail" Text
v
  unqtDot (LWidth v :: Double
v)             = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "lwidth" Double
v
  unqtDot (Margin v :: DPoint
v)             = Text -> DPoint -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "margin" DPoint
v
  unqtDot (MaxIter v :: Int
v)            = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "maxiter" Int
v
  unqtDot (MCLimit v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "mclimit" Double
v
  unqtDot (MinDist v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "mindist" Double
v
  unqtDot (MinLen v :: Int
v)             = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "minlen" Int
v
  unqtDot (Mode v :: ModeType
v)               = Text -> ModeType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "mode" ModeType
v
  unqtDot (Model v :: Model
v)              = Text -> Model -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "model" Model
v
  unqtDot (Mosek v :: Bool
v)              = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "mosek" Bool
v
  unqtDot (NodeSep v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "nodesep" Double
v
  unqtDot (NoJustify v :: Bool
v)          = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "nojustify" Bool
v
  unqtDot (Normalize v :: Normalized
v)          = Text -> Normalized -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "normalize" Normalized
v
  unqtDot (NoTranslate v :: Bool
v)        = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "notranslate" Bool
v
  unqtDot (Nslimit v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "nslimit" Double
v
  unqtDot (Nslimit1 v :: Double
v)           = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "nslimit1" Double
v
  unqtDot (Ordering v :: Order
v)           = Text -> Order -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "ordering" Order
v
  unqtDot (Orientation v :: Double
v)        = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "orientation" Double
v
  unqtDot (OutputOrder v :: OutputMode
v)        = Text -> OutputMode -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "outputorder" OutputMode
v
  unqtDot (Overlap v :: Overlap
v)            = Text -> Overlap -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "overlap" Overlap
v
  unqtDot (OverlapScaling v :: Double
v)     = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "overlap_scaling" Double
v
  unqtDot (OverlapShrink v :: Bool
v)      = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "overlap_shrink" Bool
v
  unqtDot (Pack v :: Pack
v)               = Text -> Pack -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pack" Pack
v
  unqtDot (PackMode v :: PackMode
v)           = Text -> PackMode -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "packmode" PackMode
v
  unqtDot (Pad v :: DPoint
v)                = Text -> DPoint -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pad" DPoint
v
  unqtDot (Page v :: Point
v)               = Text -> Point -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "page" Point
v
  unqtDot (PageDir v :: PageDir
v)            = Text -> PageDir -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pagedir" PageDir
v
  unqtDot (PenColor v :: Color
v)           = Text -> Color -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pencolor" Color
v
  unqtDot (PenWidth v :: Double
v)           = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "penwidth" Double
v
  unqtDot (Peripheries v :: Int
v)        = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "peripheries" Int
v
  unqtDot (Pin v :: Bool
v)                = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pin" Bool
v
  unqtDot (Pos v :: Pos
v)                = Text -> Pos -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "pos" Pos
v
  unqtDot (QuadTree v :: QuadType
v)           = Text -> QuadType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "quadtree" QuadType
v
  unqtDot (Quantum v :: Double
v)            = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "quantum" Double
v
  unqtDot (Rank v :: RankType
v)               = Text -> RankType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "rank" RankType
v
  unqtDot (RankDir v :: RankDir
v)            = Text -> RankDir -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "rankdir" RankDir
v
  unqtDot (RankSep v :: [Double]
v)            = Text -> [Double] -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "ranksep" [Double]
v
  unqtDot (Ratio v :: Ratios
v)              = Text -> Ratios -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "ratio" Ratios
v
  unqtDot (Rects v :: [Rect]
v)              = Text -> [Rect] -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "rects" [Rect]
v
  unqtDot (Regular v :: Bool
v)            = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "regular" Bool
v
  unqtDot (ReMinCross v :: Bool
v)         = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "remincross" Bool
v
  unqtDot (RepulsiveForce v :: Double
v)     = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "repulsiveforce" Double
v
  unqtDot (Root v :: Root
v)               = Text -> Root -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "root" Root
v
  unqtDot (Rotate v :: Int
v)             = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "rotate" Int
v
  unqtDot (Rotation v :: Double
v)           = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "rotation" Double
v
  unqtDot (SameHead v :: Text
v)           = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "samehead" Text
v
  unqtDot (SameTail v :: Text
v)           = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "sametail" Text
v
  unqtDot (SamplePoints v :: Int
v)       = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "samplepoints" Int
v
  unqtDot (Scale v :: DPoint
v)              = Text -> DPoint -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "scale" DPoint
v
  unqtDot (SearchSize v :: Int
v)         = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "searchsize" Int
v
  unqtDot (Sep v :: DPoint
v)                = Text -> DPoint -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "sep" DPoint
v
  unqtDot (Shape v :: Shape
v)              = Text -> Shape -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "shape" Shape
v
  unqtDot (ShowBoxes v :: Int
v)          = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "showboxes" Int
v
  unqtDot (Sides v :: Int
v)              = Text -> Int -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "sides" Int
v
  unqtDot (Size v :: GraphSize
v)               = Text -> GraphSize -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "size" GraphSize
v
  unqtDot (Skew v :: Double
v)               = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "skew" Double
v
  unqtDot (Smoothing v :: SmoothType
v)          = Text -> SmoothType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "smoothing" SmoothType
v
  unqtDot (SortV v :: Word16
v)              = Text -> Word16 -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "sortv" Word16
v
  unqtDot (Splines v :: EdgeType
v)            = Text -> EdgeType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "splines" EdgeType
v
  unqtDot (Start v :: StartType
v)              = Text -> StartType -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "start" StartType
v
  unqtDot (Style v :: [StyleItem]
v)              = Text -> [StyleItem] -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "style" [StyleItem]
v
  unqtDot (StyleSheet v :: Text
v)         = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "stylesheet" Text
v
  unqtDot (TailURL v :: Text
v)            = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tailURL" Text
v
  unqtDot (Tail_LP v :: Point
v)            = Text -> Point -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tail_lp" Point
v
  unqtDot (TailClip v :: Bool
v)           = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tailclip" Bool
v
  unqtDot (TailLabel v :: Label
v)          = Text -> Label -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "taillabel" Label
v
  unqtDot (TailPort v :: PortPos
v)           = Text -> PortPos -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tailport" PortPos
v
  unqtDot (TailTarget v :: Text
v)         = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tailtarget" Text
v
  unqtDot (TailTooltip v :: Text
v)        = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tailtooltip" Text
v
  unqtDot (Target v :: Text
v)             = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "target" Text
v
  unqtDot (Tooltip v :: Text
v)            = Text -> Text -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "tooltip" Text
v
  unqtDot (TrueColor v :: Bool
v)          = Text -> Bool -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "truecolor" Bool
v
  unqtDot (Vertices v :: [Point]
v)           = Text -> [Point] -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "vertices" [Point]
v
  unqtDot (ViewPort v :: ViewPort
v)           = Text -> ViewPort -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "viewport" ViewPort
v
  unqtDot (VoroMargin v :: Double
v)         = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "voro_margin" Double
v
  unqtDot (Weight v :: Number
v)             = Text -> Number -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "weight" Number
v
  unqtDot (Width v :: Double
v)              = Text -> Double -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "width" Double
v
  unqtDot (XDotVersion v :: Version
v)        = Text -> Version -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "xdotversion" Version
v
  unqtDot (XLabel v :: Label
v)             = Text -> Label -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "xlabel" Label
v
  unqtDot (XLP v :: Point
v)                = Text -> Point -> DotCode
forall a. PrintDot a => Text -> a -> DotCode
printField "xlp" Point
v
  unqtDot (UnknownAttribute a :: Text
a v :: Text
v) = Text -> DotCode
forall a. PrintDot a => a -> DotCode
toDot Text
a DotCode -> DotCode -> DotCode
forall a. Semigroup a => a -> a -> a
<> DotCode
forall (m :: * -> *). Applicative m => m Doc
equals DotCode -> DotCode -> DotCode
forall a. Semigroup a => a -> a -> a
<> Text -> DotCode
forall a. PrintDot a => a -> DotCode
toDot Text
v

  listToDot :: [Attribute] -> DotCode
listToDot = [Attribute] -> DotCode
forall a. PrintDot a => [a] -> DotCode
unqtListToDot

instance ParseDot Attribute where
  parseUnqt :: Parse Attribute
parseUnqt = [(String, Parse Attribute)] -> Parse Attribute
forall a. [(String, Parse a)] -> Parse a
stringParse ([[(String, Parse Attribute)]] -> [(String, Parse Attribute)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Damping "Damping"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
K "K"
                                  , (Text -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Text -> Attribute
URL ["URL", "href"]
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Area "area"
                                  , (ArrowType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ArrowType -> Attribute
ArrowHead "arrowhead"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
ArrowSize "arrowsize"
                                  , (ArrowType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ArrowType -> Attribute
ArrowTail "arrowtail"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Background "_background"
                                  , (Rect -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Rect -> Attribute
BoundingBox "bb"
                                  , (ColorList -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ColorList -> Attribute
BgColor "bgcolor"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Center "center"
                                  , (ClusterMode -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ClusterMode -> Attribute
ClusterRank "clusterrank"
                                  , (ColorList -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ColorList -> Attribute
Color "color"
                                  , (ColorScheme -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ColorScheme -> Attribute
ColorScheme "colorscheme"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Comment "comment"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Compound "compound"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Concentrate "concentrate"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Constraint "constraint"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Decorate "decorate"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
DefaultDist "defaultdist"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Dim "dim"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Dimen "dimen"
                                  , (DirType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DirType -> Attribute
Dir "dir"
                                  , (DEConstraints -> Attribute)
-> DEConstraints -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef DEConstraints -> Attribute
DirEdgeConstraints DEConstraints
EdgeConstraints "diredgeconstraints"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Distortion "distortion"
                                  , (Double -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Double -> Attribute
DPI ["dpi", "resolution"]
                                  , (Text -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Text -> Attribute
EdgeURL ["edgeURL", "edgehref"]
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
EdgeTarget "edgetarget"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
EdgeTooltip "edgetooltip"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Epsilon "epsilon"
                                  , (DPoint -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DPoint -> Attribute
ESep "esep"
                                  , (ColorList -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ColorList -> Attribute
FillColor "fillcolor"
                                  , (NodeSize -> Attribute)
-> NodeSize -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef NodeSize -> Attribute
FixedSize NodeSize
SetNodeSize "fixedsize"
                                  , (Color -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Color -> Attribute
FontColor "fontcolor"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
FontName "fontname"
                                  , (SVGFontNames -> Attribute)
-> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField SVGFontNames -> Attribute
FontNames "fontnames"
                                  , (Paths -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Paths -> Attribute
FontPath "fontpath"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
FontSize "fontsize"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
ForceLabels "forcelabels"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
GradientAngle "gradientangle"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Group "group"
                                  , (Text -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Text -> Attribute
HeadURL ["headURL", "headhref"]
                                  , (Point -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Point -> Attribute
Head_LP "head_lp"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
HeadClip "headclip"
                                  , (Label -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Label -> Attribute
HeadLabel "headlabel"
                                  , (PortPos -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField PortPos -> Attribute
HeadPort "headport"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
HeadTarget "headtarget"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
HeadTooltip "headtooltip"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Height "height"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
ID "id"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Image "image"
                                  , (Paths -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Paths -> Attribute
ImagePath "imagepath"
                                  , (ScaleType -> Attribute)
-> ScaleType -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef ScaleType -> Attribute
ImageScale ScaleType
UniformScale "imagescale"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
InputScale "inputscale"
                                  , (Label -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Label -> Attribute
Label "label"
                                  , (Text -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Text -> Attribute
LabelURL ["labelURL", "labelhref"]
                                  , (LabelScheme -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LabelScheme -> Attribute
LabelScheme "label_scheme"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LabelAngle "labelangle"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LabelDistance "labeldistance"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
LabelFloat "labelfloat"
                                  , (Color -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Color -> Attribute
LabelFontColor "labelfontcolor"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
LabelFontName "labelfontname"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LabelFontSize "labelfontsize"
                                  , (Justification -> Attribute)
-> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Justification -> Attribute
LabelJust "labeljust"
                                  , (VerticalPlacement -> Attribute)
-> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField VerticalPlacement -> Attribute
LabelLoc "labelloc"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
LabelTarget "labeltarget"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
LabelTooltip "labeltooltip"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Landscape "landscape"
                                  , (LayerRange -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LayerRange -> Attribute
Layer "layer"
                                  , (LayerListSep -> Attribute)
-> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LayerListSep -> Attribute
LayerListSep "layerlistsep"
                                  , (LayerList -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LayerList -> Attribute
Layers "layers"
                                  , (LayerRange -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LayerRange -> Attribute
LayerSelect "layerselect"
                                  , (LayerSep -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField LayerSep -> Attribute
LayerSep "layersep"
                                  , (GraphvizCommand -> Attribute)
-> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField GraphvizCommand -> Attribute
Layout "layout"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Len "len"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Levels "levels"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LevelsGap "levelsgap"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
LHead "lhead"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LHeight "LHeight"
                                  , (Point -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Point -> Attribute
LPos "lp"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
LTail "ltail"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
LWidth "lwidth"
                                  , (DPoint -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DPoint -> Attribute
Margin "margin"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
MaxIter "maxiter"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
MCLimit "mclimit"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
MinDist "mindist"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
MinLen "minlen"
                                  , (ModeType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ModeType -> Attribute
Mode "mode"
                                  , (Model -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Model -> Attribute
Model "model"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Mosek "mosek"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
NodeSep "nodesep"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
NoJustify "nojustify"
                                  , (Normalized -> Attribute)
-> Normalized -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef Normalized -> Attribute
Normalize Normalized
IsNormalized "normalize"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
NoTranslate "notranslate"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Nslimit "nslimit"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Nslimit1 "nslimit1"
                                  , (Order -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Order -> Attribute
Ordering "ordering"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Orientation "orientation"
                                  , (OutputMode -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField OutputMode -> Attribute
OutputOrder "outputorder"
                                  , (Overlap -> Attribute)
-> Overlap -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef Overlap -> Attribute
Overlap Overlap
KeepOverlaps "overlap"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
OverlapScaling "overlap_scaling"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
OverlapShrink "overlap_shrink"
                                  , (Pack -> Attribute)
-> Pack -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef Pack -> Attribute
Pack Pack
DoPack "pack"
                                  , (PackMode -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField PackMode -> Attribute
PackMode "packmode"
                                  , (DPoint -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DPoint -> Attribute
Pad "pad"
                                  , (Point -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Point -> Attribute
Page "page"
                                  , (PageDir -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField PageDir -> Attribute
PageDir "pagedir"
                                  , (Color -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Color -> Attribute
PenColor "pencolor"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
PenWidth "penwidth"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Peripheries "peripheries"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Pin "pin"
                                  , (Pos -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Pos -> Attribute
Pos "pos"
                                  , (QuadType -> Attribute)
-> QuadType -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef QuadType -> Attribute
QuadTree QuadType
NormalQT "quadtree"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Quantum "quantum"
                                  , (RankType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField RankType -> Attribute
Rank "rank"
                                  , (RankDir -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField RankDir -> Attribute
RankDir "rankdir"
                                  , ([Double] -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField [Double] -> Attribute
RankSep "ranksep"
                                  , (Ratios -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Ratios -> Attribute
Ratio "ratio"
                                  , ([Rect] -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField [Rect] -> Attribute
Rects "rects"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
Regular "regular"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
ReMinCross "remincross"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
RepulsiveForce "repulsiveforce"
                                  , (Root -> Attribute)
-> Root -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef Root -> Attribute
Root Root
IsCentral "root"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Rotate "rotate"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Rotation "rotation"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
SameHead "samehead"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
SameTail "sametail"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
SamplePoints "samplepoints"
                                  , (DPoint -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DPoint -> Attribute
Scale "scale"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
SearchSize "searchsize"
                                  , (DPoint -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField DPoint -> Attribute
Sep "sep"
                                  , (Shape -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Shape -> Attribute
Shape "shape"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
ShowBoxes "showboxes"
                                  , (Int -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Int -> Attribute
Sides "sides"
                                  , (GraphSize -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField GraphSize -> Attribute
Size "size"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Skew "skew"
                                  , (SmoothType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField SmoothType -> Attribute
Smoothing "smoothing"
                                  , (Word16 -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Word16 -> Attribute
SortV "sortv"
                                  , (EdgeType -> Attribute)
-> EdgeType -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef EdgeType -> Attribute
Splines EdgeType
SplineEdges "splines"
                                  , (StartType -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField StartType -> Attribute
Start "start"
                                  , ([StyleItem] -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField [StyleItem] -> Attribute
Style "style"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
StyleSheet "stylesheet"
                                  , (Text -> Attribute) -> [String] -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields Text -> Attribute
TailURL ["tailURL", "tailhref"]
                                  , (Point -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Point -> Attribute
Tail_LP "tail_lp"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
TailClip "tailclip"
                                  , (Label -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Label -> Attribute
TailLabel "taillabel"
                                  , (PortPos -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField PortPos -> Attribute
TailPort "tailport"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
TailTarget "tailtarget"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
TailTooltip "tailtooltip"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Target "target"
                                  , (Text -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Text -> Attribute
Tooltip "tooltip"
                                  , (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool Bool -> Attribute
TrueColor "truecolor"
                                  , ([Point] -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField [Point] -> Attribute
Vertices "vertices"
                                  , (ViewPort -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField ViewPort -> Attribute
ViewPort "viewport"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
VoroMargin "voro_margin"
                                  , (Number -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Number -> Attribute
Weight "weight"
                                  , (Double -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Double -> Attribute
Width "width"
                                  , (Version -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Version -> Attribute
XDotVersion "xdotversion"
                                  , (Label -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Label -> Attribute
XLabel "xlabel"
                                  , (Point -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField Point -> Attribute
XLP "xlp"
                                  ])
              Parse Attribute -> Parse Attribute -> Parse Attribute
forall s a. Parser s a -> Parser s a -> Parser s a
`onFail`
              do Text
attrName <- Parse Text
stringBlock
                 String -> (Text -> Attribute) -> Parse Attribute
forall a.
ParseDot a =>
String -> (a -> Attribute) -> Parse Attribute
liftEqParse ("UnknownAttribute (" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
T.unpack Text
attrName String -> ShowS
forall a. [a] -> [a] -> [a]
++ ")")
                             (Text -> Text -> Attribute
UnknownAttribute Text
attrName)

  parse :: Parse Attribute
parse = Parse Attribute
forall a. ParseDot a => Parse a
parseUnqt

  parseList :: Parse [Attribute]
parseList = Parse [Attribute]
forall a. ParseDot a => Parse [a]
parseUnqtList

-- | Determine if this 'Attribute' is valid for use with Graphs.
usedByGraphs                      :: Attribute -> Bool
usedByGraphs :: Attribute -> Bool
usedByGraphs Damping{}            = Bool
True
usedByGraphs K{}                  = Bool
True
usedByGraphs URL{}                = Bool
True
usedByGraphs Background{}         = Bool
True
usedByGraphs BoundingBox{}        = Bool
True
usedByGraphs BgColor{}            = Bool
True
usedByGraphs Center{}             = Bool
True
usedByGraphs ClusterRank{}        = Bool
True
usedByGraphs ColorScheme{}        = Bool
True
usedByGraphs Comment{}            = Bool
True
usedByGraphs Compound{}           = Bool
True
usedByGraphs Concentrate{}        = Bool
True
usedByGraphs DefaultDist{}        = Bool
True
usedByGraphs Dim{}                = Bool
True
usedByGraphs Dimen{}              = Bool
True
usedByGraphs DirEdgeConstraints{} = Bool
True
usedByGraphs DPI{}                = Bool
True
usedByGraphs Epsilon{}            = Bool
True
usedByGraphs ESep{}               = Bool
True
usedByGraphs FontColor{}          = Bool
True
usedByGraphs FontName{}           = Bool
True
usedByGraphs FontNames{}          = Bool
True
usedByGraphs FontPath{}           = Bool
True
usedByGraphs FontSize{}           = Bool
True
usedByGraphs ForceLabels{}        = Bool
True
usedByGraphs GradientAngle{}      = Bool
True
usedByGraphs ID{}                 = Bool
True
usedByGraphs ImagePath{}          = Bool
True
usedByGraphs Label{}              = Bool
True
usedByGraphs LabelScheme{}        = Bool
True
usedByGraphs LabelJust{}          = Bool
True
usedByGraphs LabelLoc{}           = Bool
True
usedByGraphs Landscape{}          = Bool
True
usedByGraphs LayerListSep{}       = Bool
True
usedByGraphs Layers{}             = Bool
True
usedByGraphs LayerSelect{}        = Bool
True
usedByGraphs LayerSep{}           = Bool
True
usedByGraphs Layout{}             = Bool
True
usedByGraphs Levels{}             = Bool
True
usedByGraphs LevelsGap{}          = Bool
True
usedByGraphs LHeight{}            = Bool
True
usedByGraphs LPos{}               = Bool
True
usedByGraphs LWidth{}             = Bool
True
usedByGraphs Margin{}             = Bool
True
usedByGraphs MaxIter{}            = Bool
True
usedByGraphs MCLimit{}            = Bool
True
usedByGraphs MinDist{}            = Bool
True
usedByGraphs Mode{}               = Bool
True
usedByGraphs Model{}              = Bool
True
usedByGraphs Mosek{}              = Bool
True
usedByGraphs NodeSep{}            = Bool
True
usedByGraphs NoJustify{}          = Bool
True
usedByGraphs Normalize{}          = Bool
True
usedByGraphs NoTranslate{}        = Bool
True
usedByGraphs Nslimit{}            = Bool
True
usedByGraphs Nslimit1{}           = Bool
True
usedByGraphs Ordering{}           = Bool
True
usedByGraphs OutputOrder{}        = Bool
True
usedByGraphs Overlap{}            = Bool
True
usedByGraphs OverlapScaling{}     = Bool
True
usedByGraphs OverlapShrink{}      = Bool
True
usedByGraphs Pack{}               = Bool
True
usedByGraphs PackMode{}           = Bool
True
usedByGraphs Pad{}                = Bool
True
usedByGraphs Page{}               = Bool
True
usedByGraphs PageDir{}            = Bool
True
usedByGraphs QuadTree{}           = Bool
True
usedByGraphs Quantum{}            = Bool
True
usedByGraphs RankDir{}            = Bool
True
usedByGraphs RankSep{}            = Bool
True
usedByGraphs Ratio{}              = Bool
True
usedByGraphs ReMinCross{}         = Bool
True
usedByGraphs RepulsiveForce{}     = Bool
True
usedByGraphs Root{}               = Bool
True
usedByGraphs Rotate{}             = Bool
True
usedByGraphs Rotation{}           = Bool
True
usedByGraphs Scale{}              = Bool
True
usedByGraphs SearchSize{}         = Bool
True
usedByGraphs Sep{}                = Bool
True
usedByGraphs ShowBoxes{}          = Bool
True
usedByGraphs Size{}               = Bool
True
usedByGraphs Smoothing{}          = Bool
True
usedByGraphs SortV{}              = Bool
True
usedByGraphs Splines{}            = Bool
True
usedByGraphs Start{}              = Bool
True
usedByGraphs Style{}              = Bool
True
usedByGraphs StyleSheet{}         = Bool
True
usedByGraphs Target{}             = Bool
True
usedByGraphs TrueColor{}          = Bool
True
usedByGraphs ViewPort{}           = Bool
True
usedByGraphs VoroMargin{}         = Bool
True
usedByGraphs XDotVersion{}        = Bool
True
usedByGraphs UnknownAttribute{}   = Bool
True
usedByGraphs _                    = Bool
False

-- | Determine if this 'Attribute' is valid for use with Clusters.
usedByClusters                    :: Attribute -> Bool
usedByClusters :: Attribute -> Bool
usedByClusters K{}                = Bool
True
usedByClusters URL{}              = Bool
True
usedByClusters Area{}             = Bool
True
usedByClusters BgColor{}          = Bool
True
usedByClusters Color{}            = Bool
True
usedByClusters ColorScheme{}      = Bool
True
usedByClusters FillColor{}        = Bool
True
usedByClusters FontColor{}        = Bool
True
usedByClusters FontName{}         = Bool
True
usedByClusters FontSize{}         = Bool
True
usedByClusters GradientAngle{}    = Bool
True
usedByClusters Label{}            = Bool
True
usedByClusters LabelJust{}        = Bool
True
usedByClusters LabelLoc{}         = Bool
True
usedByClusters Layer{}            = Bool
True
usedByClusters LHeight{}          = Bool
True
usedByClusters LPos{}             = Bool
True
usedByClusters LWidth{}           = Bool
True
usedByClusters Margin{}           = Bool
True
usedByClusters NoJustify{}        = Bool
True
usedByClusters PenColor{}         = Bool
True
usedByClusters PenWidth{}         = Bool
True
usedByClusters Peripheries{}      = Bool
True
usedByClusters Rank{}             = Bool
True
usedByClusters SortV{}            = Bool
True
usedByClusters Style{}            = Bool
True
usedByClusters Target{}           = Bool
True
usedByClusters Tooltip{}          = Bool
True
usedByClusters UnknownAttribute{} = Bool
True
usedByClusters _                  = Bool
False

-- | Determine if this 'Attribute' is valid for use with SubGraphs.
usedBySubGraphs                    :: Attribute -> Bool
usedBySubGraphs :: Attribute -> Bool
usedBySubGraphs Rank{}             = Bool
True
usedBySubGraphs UnknownAttribute{} = Bool
True
usedBySubGraphs _                  = Bool
False

-- | Determine if this 'Attribute' is valid for use with Nodes.
usedByNodes                    :: Attribute -> Bool
usedByNodes :: Attribute -> Bool
usedByNodes URL{}              = Bool
True
usedByNodes Area{}             = Bool
True
usedByNodes Color{}            = Bool
True
usedByNodes ColorScheme{}      = Bool
True
usedByNodes Comment{}          = Bool
True
usedByNodes Distortion{}       = Bool
True
usedByNodes FillColor{}        = Bool
True
usedByNodes FixedSize{}        = Bool
True
usedByNodes FontColor{}        = Bool
True
usedByNodes FontName{}         = Bool
True
usedByNodes FontSize{}         = Bool
True
usedByNodes GradientAngle{}    = Bool
True
usedByNodes Group{}            = Bool
True
usedByNodes Height{}           = Bool
True
usedByNodes ID{}               = Bool
True
usedByNodes Image{}            = Bool
True
usedByNodes ImageScale{}       = Bool
True
usedByNodes InputScale{}       = Bool
True
usedByNodes Label{}            = Bool
True
usedByNodes LabelLoc{}         = Bool
True
usedByNodes Layer{}            = Bool
True
usedByNodes Margin{}           = Bool
True
usedByNodes NoJustify{}        = Bool
True
usedByNodes Ordering{}         = Bool
True
usedByNodes Orientation{}      = Bool
True
usedByNodes PenWidth{}         = Bool
True
usedByNodes Peripheries{}      = Bool
True
usedByNodes Pin{}              = Bool
True
usedByNodes Pos{}              = Bool
True
usedByNodes Rects{}            = Bool
True
usedByNodes Regular{}          = Bool
True
usedByNodes Root{}             = Bool
True
usedByNodes SamplePoints{}     = Bool
True
usedByNodes Shape{}            = Bool
True
usedByNodes ShowBoxes{}        = Bool
True
usedByNodes Sides{}            = Bool
True
usedByNodes Skew{}             = Bool
True
usedByNodes SortV{}            = Bool
True
usedByNodes Style{}            = Bool
True
usedByNodes Target{}           = Bool
True
usedByNodes Tooltip{}          = Bool
True
usedByNodes Vertices{}         = Bool
True
usedByNodes Width{}            = Bool
True
usedByNodes XLabel{}           = Bool
True
usedByNodes XLP{}              = Bool
True
usedByNodes UnknownAttribute{} = Bool
True
usedByNodes _                  = Bool
False

-- | Determine if this 'Attribute' is valid for use with Edges.
usedByEdges                    :: Attribute -> Bool
usedByEdges :: Attribute -> Bool
usedByEdges URL{}              = Bool
True
usedByEdges ArrowHead{}        = Bool
True
usedByEdges ArrowSize{}        = Bool
True
usedByEdges ArrowTail{}        = Bool
True
usedByEdges Color{}            = Bool
True
usedByEdges ColorScheme{}      = Bool
True
usedByEdges Comment{}          = Bool
True
usedByEdges Constraint{}       = Bool
True
usedByEdges Decorate{}         = Bool
True
usedByEdges Dir{}              = Bool
True
usedByEdges EdgeURL{}          = Bool
True
usedByEdges EdgeTarget{}       = Bool
True
usedByEdges EdgeTooltip{}      = Bool
True
usedByEdges FillColor{}        = Bool
True
usedByEdges FontColor{}        = Bool
True
usedByEdges FontName{}         = Bool
True
usedByEdges FontSize{}         = Bool
True
usedByEdges HeadURL{}          = Bool
True
usedByEdges Head_LP{}          = Bool
True
usedByEdges HeadClip{}         = Bool
True
usedByEdges HeadLabel{}        = Bool
True
usedByEdges HeadPort{}         = Bool
True
usedByEdges HeadTarget{}       = Bool
True
usedByEdges HeadTooltip{}      = Bool
True
usedByEdges ID{}               = Bool
True
usedByEdges Label{}            = Bool
True
usedByEdges LabelURL{}         = Bool
True
usedByEdges LabelAngle{}       = Bool
True
usedByEdges LabelDistance{}    = Bool
True
usedByEdges LabelFloat{}       = Bool
True
usedByEdges LabelFontColor{}   = Bool
True
usedByEdges LabelFontName{}    = Bool
True
usedByEdges LabelFontSize{}    = Bool
True
usedByEdges LabelTarget{}      = Bool
True
usedByEdges LabelTooltip{}     = Bool
True
usedByEdges Layer{}            = Bool
True
usedByEdges Len{}              = Bool
True
usedByEdges LHead{}            = Bool
True
usedByEdges LPos{}             = Bool
True
usedByEdges LTail{}            = Bool
True
usedByEdges MinLen{}           = Bool
True
usedByEdges NoJustify{}        = Bool
True
usedByEdges PenWidth{}         = Bool
True
usedByEdges Pos{}              = Bool
True
usedByEdges SameHead{}         = Bool
True
usedByEdges SameTail{}         = Bool
True
usedByEdges ShowBoxes{}        = Bool
True
usedByEdges Style{}            = Bool
True
usedByEdges TailURL{}          = Bool
True
usedByEdges Tail_LP{}          = Bool
True
usedByEdges TailClip{}         = Bool
True
usedByEdges TailLabel{}        = Bool
True
usedByEdges TailPort{}         = Bool
True
usedByEdges TailTarget{}       = Bool
True
usedByEdges TailTooltip{}      = Bool
True
usedByEdges Target{}           = Bool
True
usedByEdges Tooltip{}          = Bool
True
usedByEdges Weight{}           = Bool
True
usedByEdges XLabel{}           = Bool
True
usedByEdges XLP{}              = Bool
True
usedByEdges UnknownAttribute{} = Bool
True
usedByEdges _                  = Bool
False

-- | Determine if two 'Attributes' are the same type of 'Attribute'.
sameAttribute                                                 :: Attribute -> Attribute -> Bool
sameAttribute :: Attribute -> Attribute -> Bool
sameAttribute Damping{}               Damping{}               = Bool
True
sameAttribute K{}                     K{}                     = Bool
True
sameAttribute URL{}                   URL{}                   = Bool
True
sameAttribute Area{}                  Area{}                  = Bool
True
sameAttribute ArrowHead{}             ArrowHead{}             = Bool
True
sameAttribute ArrowSize{}             ArrowSize{}             = Bool
True
sameAttribute ArrowTail{}             ArrowTail{}             = Bool
True
sameAttribute Background{}            Background{}            = Bool
True
sameAttribute BoundingBox{}           BoundingBox{}           = Bool
True
sameAttribute BgColor{}               BgColor{}               = Bool
True
sameAttribute Center{}                Center{}                = Bool
True
sameAttribute ClusterRank{}           ClusterRank{}           = Bool
True
sameAttribute Color{}                 Color{}                 = Bool
True
sameAttribute ColorScheme{}           ColorScheme{}           = Bool
True
sameAttribute Comment{}               Comment{}               = Bool
True
sameAttribute Compound{}              Compound{}              = Bool
True
sameAttribute Concentrate{}           Concentrate{}           = Bool
True
sameAttribute Constraint{}            Constraint{}            = Bool
True
sameAttribute Decorate{}              Decorate{}              = Bool
True
sameAttribute DefaultDist{}           DefaultDist{}           = Bool
True
sameAttribute Dim{}                   Dim{}                   = Bool
True
sameAttribute Dimen{}                 Dimen{}                 = Bool
True
sameAttribute Dir{}                   Dir{}                   = Bool
True
sameAttribute DirEdgeConstraints{}    DirEdgeConstraints{}    = Bool
True
sameAttribute Distortion{}            Distortion{}            = Bool
True
sameAttribute DPI{}                   DPI{}                   = Bool
True
sameAttribute EdgeURL{}               EdgeURL{}               = Bool
True
sameAttribute EdgeTarget{}            EdgeTarget{}            = Bool
True
sameAttribute EdgeTooltip{}           EdgeTooltip{}           = Bool
True
sameAttribute Epsilon{}               Epsilon{}               = Bool
True
sameAttribute ESep{}                  ESep{}                  = Bool
True
sameAttribute FillColor{}             FillColor{}             = Bool
True
sameAttribute FixedSize{}             FixedSize{}             = Bool
True
sameAttribute FontColor{}             FontColor{}             = Bool
True
sameAttribute FontName{}              FontName{}              = Bool
True
sameAttribute FontNames{}             FontNames{}             = Bool
True
sameAttribute FontPath{}              FontPath{}              = Bool
True
sameAttribute FontSize{}              FontSize{}              = Bool
True
sameAttribute ForceLabels{}           ForceLabels{}           = Bool
True
sameAttribute GradientAngle{}         GradientAngle{}         = Bool
True
sameAttribute Group{}                 Group{}                 = Bool
True
sameAttribute HeadURL{}               HeadURL{}               = Bool
True
sameAttribute Head_LP{}               Head_LP{}               = Bool
True
sameAttribute HeadClip{}              HeadClip{}              = Bool
True
sameAttribute HeadLabel{}             HeadLabel{}             = Bool
True
sameAttribute HeadPort{}              HeadPort{}              = Bool
True
sameAttribute HeadTarget{}            HeadTarget{}            = Bool
True
sameAttribute HeadTooltip{}           HeadTooltip{}           = Bool
True
sameAttribute Height{}                Height{}                = Bool
True
sameAttribute ID{}                    ID{}                    = Bool
True
sameAttribute Image{}                 Image{}                 = Bool
True
sameAttribute ImagePath{}             ImagePath{}             = Bool
True
sameAttribute ImageScale{}            ImageScale{}            = Bool
True
sameAttribute InputScale{}            InputScale{}            = Bool
True
sameAttribute Label{}                 Label{}                 = Bool
True
sameAttribute LabelURL{}              LabelURL{}              = Bool
True
sameAttribute LabelScheme{}           LabelScheme{}           = Bool
True
sameAttribute LabelAngle{}            LabelAngle{}            = Bool
True
sameAttribute LabelDistance{}         LabelDistance{}         = Bool
True
sameAttribute LabelFloat{}            LabelFloat{}            = Bool
True
sameAttribute LabelFontColor{}        LabelFontColor{}        = Bool
True
sameAttribute LabelFontName{}         LabelFontName{}         = Bool
True
sameAttribute LabelFontSize{}         LabelFontSize{}         = Bool
True
sameAttribute LabelJust{}             LabelJust{}             = Bool
True
sameAttribute LabelLoc{}              LabelLoc{}              = Bool
True
sameAttribute LabelTarget{}           LabelTarget{}           = Bool
True
sameAttribute LabelTooltip{}          LabelTooltip{}          = Bool
True
sameAttribute Landscape{}             Landscape{}             = Bool
True
sameAttribute Layer{}                 Layer{}                 = Bool
True
sameAttribute LayerListSep{}          LayerListSep{}          = Bool
True
sameAttribute Layers{}                Layers{}                = Bool
True
sameAttribute LayerSelect{}           LayerSelect{}           = Bool
True
sameAttribute LayerSep{}              LayerSep{}              = Bool
True
sameAttribute Layout{}                Layout{}                = Bool
True
sameAttribute Len{}                   Len{}                   = Bool
True
sameAttribute Levels{}                Levels{}                = Bool
True
sameAttribute LevelsGap{}             LevelsGap{}             = Bool
True
sameAttribute LHead{}                 LHead{}                 = Bool
True
sameAttribute LHeight{}               LHeight{}               = Bool
True
sameAttribute LPos{}                  LPos{}                  = Bool
True
sameAttribute LTail{}                 LTail{}                 = Bool
True
sameAttribute LWidth{}                LWidth{}                = Bool
True
sameAttribute Margin{}                Margin{}                = Bool
True
sameAttribute MaxIter{}               MaxIter{}               = Bool
True
sameAttribute MCLimit{}               MCLimit{}               = Bool
True
sameAttribute MinDist{}               MinDist{}               = Bool
True
sameAttribute MinLen{}                MinLen{}                = Bool
True
sameAttribute Mode{}                  Mode{}                  = Bool
True
sameAttribute Model{}                 Model{}                 = Bool
True
sameAttribute Mosek{}                 Mosek{}                 = Bool
True
sameAttribute NodeSep{}               NodeSep{}               = Bool
True
sameAttribute NoJustify{}             NoJustify{}             = Bool
True
sameAttribute Normalize{}             Normalize{}             = Bool
True
sameAttribute NoTranslate{}           NoTranslate{}           = Bool
True
sameAttribute Nslimit{}               Nslimit{}               = Bool
True
sameAttribute Nslimit1{}              Nslimit1{}              = Bool
True
sameAttribute Ordering{}              Ordering{}              = Bool
True
sameAttribute Orientation{}           Orientation{}           = Bool
True
sameAttribute OutputOrder{}           OutputOrder{}           = Bool
True
sameAttribute Overlap{}               Overlap{}               = Bool
True
sameAttribute OverlapScaling{}        OverlapScaling{}        = Bool
True
sameAttribute OverlapShrink{}         OverlapShrink{}         = Bool
True
sameAttribute Pack{}                  Pack{}                  = Bool
True
sameAttribute PackMode{}              PackMode{}              = Bool
True
sameAttribute Pad{}                   Pad{}                   = Bool
True
sameAttribute Page{}                  Page{}                  = Bool
True
sameAttribute PageDir{}               PageDir{}               = Bool
True
sameAttribute PenColor{}              PenColor{}              = Bool
True
sameAttribute PenWidth{}              PenWidth{}              = Bool
True
sameAttribute Peripheries{}           Peripheries{}           = Bool
True
sameAttribute Pin{}                   Pin{}                   = Bool
True
sameAttribute Pos{}                   Pos{}                   = Bool
True
sameAttribute QuadTree{}              QuadTree{}              = Bool
True
sameAttribute Quantum{}               Quantum{}               = Bool
True
sameAttribute Rank{}                  Rank{}                  = Bool
True
sameAttribute RankDir{}               RankDir{}               = Bool
True
sameAttribute RankSep{}               RankSep{}               = Bool
True
sameAttribute Ratio{}                 Ratio{}                 = Bool
True
sameAttribute Rects{}                 Rects{}                 = Bool
True
sameAttribute Regular{}               Regular{}               = Bool
True
sameAttribute ReMinCross{}            ReMinCross{}            = Bool
True
sameAttribute RepulsiveForce{}        RepulsiveForce{}        = Bool
True
sameAttribute Root{}                  Root{}                  = Bool
True
sameAttribute Rotate{}                Rotate{}                = Bool
True
sameAttribute Rotation{}              Rotation{}              = Bool
True
sameAttribute SameHead{}              SameHead{}              = Bool
True
sameAttribute SameTail{}              SameTail{}              = Bool
True
sameAttribute SamplePoints{}          SamplePoints{}          = Bool
True
sameAttribute Scale{}                 Scale{}                 = Bool
True
sameAttribute SearchSize{}            SearchSize{}            = Bool
True
sameAttribute Sep{}                   Sep{}                   = Bool
True
sameAttribute Shape{}                 Shape{}                 = Bool
True
sameAttribute ShowBoxes{}             ShowBoxes{}             = Bool
True
sameAttribute Sides{}                 Sides{}                 = Bool
True
sameAttribute Size{}                  Size{}                  = Bool
True
sameAttribute Skew{}                  Skew{}                  = Bool
True
sameAttribute Smoothing{}             Smoothing{}             = Bool
True
sameAttribute SortV{}                 SortV{}                 = Bool
True
sameAttribute Splines{}               Splines{}               = Bool
True
sameAttribute Start{}                 Start{}                 = Bool
True
sameAttribute Style{}                 Style{}                 = Bool
True
sameAttribute StyleSheet{}            StyleSheet{}            = Bool
True
sameAttribute TailURL{}               TailURL{}               = Bool
True
sameAttribute Tail_LP{}               Tail_LP{}               = Bool
True
sameAttribute TailClip{}              TailClip{}              = Bool
True
sameAttribute TailLabel{}             TailLabel{}             = Bool
True
sameAttribute TailPort{}              TailPort{}              = Bool
True
sameAttribute TailTarget{}            TailTarget{}            = Bool
True
sameAttribute TailTooltip{}           TailTooltip{}           = Bool
True
sameAttribute Target{}                Target{}                = Bool
True
sameAttribute Tooltip{}               Tooltip{}               = Bool
True
sameAttribute TrueColor{}             TrueColor{}             = Bool
True
sameAttribute Vertices{}              Vertices{}              = Bool
True
sameAttribute ViewPort{}              ViewPort{}              = Bool
True
sameAttribute VoroMargin{}            VoroMargin{}            = Bool
True
sameAttribute Weight{}                Weight{}                = Bool
True
sameAttribute Width{}                 Width{}                 = Bool
True
sameAttribute XDotVersion{}           XDotVersion{}           = Bool
True
sameAttribute XLabel{}                XLabel{}                = Bool
True
sameAttribute XLP{}                   XLP{}                   = Bool
True
sameAttribute (UnknownAttribute a1 :: Text
a1 _) (UnknownAttribute a2 :: Text
a2 _) = Text
a1 Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
a2
sameAttribute _                       _                       = Bool
False

-- | Return the default value for a specific 'Attribute' if possible; graph/cluster values are preferred over node/edge values.
defaultAttributeValue                      :: Attribute -> Maybe Attribute
defaultAttributeValue :: Attribute -> Maybe Attribute
defaultAttributeValue Damping{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Damping 0.99
defaultAttributeValue K{}                  = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
K 0.3
defaultAttributeValue URL{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
URL ""
defaultAttributeValue Area{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Area 1.0
defaultAttributeValue ArrowHead{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ArrowType -> Attribute
ArrowHead ArrowType
normal
defaultAttributeValue ArrowSize{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
ArrowSize 1.0
defaultAttributeValue ArrowTail{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ArrowType -> Attribute
ArrowTail ArrowType
normal
defaultAttributeValue Background{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Background ""
defaultAttributeValue BgColor{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ColorList -> Attribute
BgColor []
defaultAttributeValue Center{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Center Bool
False
defaultAttributeValue ClusterRank{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ClusterMode -> Attribute
ClusterRank ClusterMode
Local
defaultAttributeValue Color{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ColorList -> Attribute
Color [X11Color -> WeightedColor
forall nc. NamedColor nc => nc -> WeightedColor
toWColor X11Color
Black]
defaultAttributeValue ColorScheme{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ColorScheme -> Attribute
ColorScheme ColorScheme
X11
defaultAttributeValue Comment{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Comment ""
defaultAttributeValue Compound{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Compound Bool
False
defaultAttributeValue Concentrate{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Concentrate Bool
False
defaultAttributeValue Constraint{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Constraint Bool
True
defaultAttributeValue Decorate{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Decorate Bool
False
defaultAttributeValue Dim{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Dim 2
defaultAttributeValue Dimen{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Dimen 2
defaultAttributeValue DirEdgeConstraints{} = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ DEConstraints -> Attribute
DirEdgeConstraints DEConstraints
NoConstraints
defaultAttributeValue Distortion{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Distortion 0.0
defaultAttributeValue DPI{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
DPI 96.0
defaultAttributeValue EdgeURL{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
EdgeURL ""
defaultAttributeValue EdgeTooltip{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
EdgeTooltip ""
defaultAttributeValue ESep{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ DPoint -> Attribute
ESep (Double -> DPoint
DVal 3)
defaultAttributeValue FillColor{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ColorList -> Attribute
FillColor [X11Color -> WeightedColor
forall nc. NamedColor nc => nc -> WeightedColor
toWColor X11Color
Black]
defaultAttributeValue FixedSize{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ NodeSize -> Attribute
FixedSize NodeSize
GrowAsNeeded
defaultAttributeValue FontColor{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Color -> Attribute
FontColor (X11Color -> Color
X11Color X11Color
Black)
defaultAttributeValue FontName{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
FontName "Times-Roman"
defaultAttributeValue FontNames{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ SVGFontNames -> Attribute
FontNames SVGFontNames
SvgNames
defaultAttributeValue FontSize{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
FontSize 14.0
defaultAttributeValue ForceLabels{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
ForceLabels Bool
True
defaultAttributeValue GradientAngle{}      = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
GradientAngle 0
defaultAttributeValue Group{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Group ""
defaultAttributeValue HeadURL{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
HeadURL ""
defaultAttributeValue HeadClip{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
HeadClip Bool
True
defaultAttributeValue HeadLabel{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Label -> Attribute
HeadLabel (Text -> Label
StrLabel "")
defaultAttributeValue HeadPort{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ PortPos -> Attribute
HeadPort (CompassPoint -> PortPos
CompassPoint CompassPoint
CenterPoint)
defaultAttributeValue HeadTarget{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
HeadTarget ""
defaultAttributeValue HeadTooltip{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
HeadTooltip ""
defaultAttributeValue Height{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Height 0.5
defaultAttributeValue ID{}                 = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
ID ""
defaultAttributeValue Image{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Image ""
defaultAttributeValue ImagePath{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Paths -> Attribute
ImagePath ([String] -> Paths
Paths [])
defaultAttributeValue ImageScale{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ScaleType -> Attribute
ImageScale ScaleType
NoScale
defaultAttributeValue Label{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Label -> Attribute
Label (Text -> Label
StrLabel "")
defaultAttributeValue LabelURL{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LabelURL ""
defaultAttributeValue LabelScheme{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LabelScheme -> Attribute
LabelScheme LabelScheme
NotEdgeLabel
defaultAttributeValue LabelAngle{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
LabelAngle (-25.0)
defaultAttributeValue LabelDistance{}      = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
LabelDistance 1.0
defaultAttributeValue LabelFloat{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
LabelFloat Bool
False
defaultAttributeValue LabelFontColor{}     = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Color -> Attribute
LabelFontColor (X11Color -> Color
X11Color X11Color
Black)
defaultAttributeValue LabelFontName{}      = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LabelFontName "Times-Roman"
defaultAttributeValue LabelFontSize{}      = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
LabelFontSize 14.0
defaultAttributeValue LabelJust{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Justification -> Attribute
LabelJust Justification
JCenter
defaultAttributeValue LabelLoc{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ VerticalPlacement -> Attribute
LabelLoc VerticalPlacement
VTop
defaultAttributeValue LabelTarget{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LabelTarget ""
defaultAttributeValue LabelTooltip{}       = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LabelTooltip ""
defaultAttributeValue Landscape{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Landscape Bool
False
defaultAttributeValue Layer{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LayerRange -> Attribute
Layer []
defaultAttributeValue LayerListSep{}       = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LayerListSep -> Attribute
LayerListSep (Text -> LayerListSep
LLSep ",")
defaultAttributeValue Layers{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LayerList -> Attribute
Layers ([LayerID] -> LayerList
LL [])
defaultAttributeValue LayerSelect{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LayerRange -> Attribute
LayerSelect []
defaultAttributeValue LayerSep{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ LayerSep -> Attribute
LayerSep (Text -> LayerSep
LSep " :\t")
defaultAttributeValue Levels{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Levels Int
forall a. Bounded a => a
maxBound
defaultAttributeValue LevelsGap{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
LevelsGap 0.0
defaultAttributeValue LHead{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LHead ""
defaultAttributeValue LTail{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
LTail ""
defaultAttributeValue MCLimit{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
MCLimit 1.0
defaultAttributeValue MinDist{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
MinDist 1.0
defaultAttributeValue MinLen{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
MinLen 1
defaultAttributeValue Mode{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ ModeType -> Attribute
Mode ModeType
Major
defaultAttributeValue Model{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Model -> Attribute
Model Model
ShortPath
defaultAttributeValue Mosek{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Mosek Bool
False
defaultAttributeValue NodeSep{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
NodeSep 0.25
defaultAttributeValue NoJustify{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
NoJustify Bool
False
defaultAttributeValue Normalize{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Normalized -> Attribute
Normalize Normalized
NotNormalized
defaultAttributeValue NoTranslate{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
NoTranslate Bool
False
defaultAttributeValue Orientation{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Orientation 0.0
defaultAttributeValue OutputOrder{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ OutputMode -> Attribute
OutputOrder OutputMode
BreadthFirst
defaultAttributeValue Overlap{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Overlap -> Attribute
Overlap Overlap
KeepOverlaps
defaultAttributeValue OverlapScaling{}     = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
OverlapScaling (-4)
defaultAttributeValue OverlapShrink{}      = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
OverlapShrink Bool
True
defaultAttributeValue Pack{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Pack -> Attribute
Pack Pack
DontPack
defaultAttributeValue PackMode{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ PackMode -> Attribute
PackMode PackMode
PackNode
defaultAttributeValue Pad{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ DPoint -> Attribute
Pad (Double -> DPoint
DVal 0.0555)
defaultAttributeValue PageDir{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ PageDir -> Attribute
PageDir PageDir
Bl
defaultAttributeValue PenColor{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Color -> Attribute
PenColor (X11Color -> Color
X11Color X11Color
Black)
defaultAttributeValue PenWidth{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
PenWidth 1.0
defaultAttributeValue Peripheries{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Peripheries 1
defaultAttributeValue Pin{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Pin Bool
False
defaultAttributeValue QuadTree{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ QuadType -> Attribute
QuadTree QuadType
NormalQT
defaultAttributeValue Quantum{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Quantum 0
defaultAttributeValue RankDir{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ RankDir -> Attribute
RankDir RankDir
FromTop
defaultAttributeValue Regular{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
Regular Bool
False
defaultAttributeValue ReMinCross{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
ReMinCross Bool
False
defaultAttributeValue RepulsiveForce{}     = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
RepulsiveForce 1.0
defaultAttributeValue Root{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Root -> Attribute
Root (Text -> Root
NodeName "")
defaultAttributeValue Rotate{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Rotate 0
defaultAttributeValue Rotation{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Rotation 0
defaultAttributeValue SameHead{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
SameHead ""
defaultAttributeValue SameTail{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
SameTail ""
defaultAttributeValue SearchSize{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
SearchSize 30
defaultAttributeValue Sep{}                = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ DPoint -> Attribute
Sep (Double -> DPoint
DVal 4)
defaultAttributeValue Shape{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Shape -> Attribute
Shape Shape
Ellipse
defaultAttributeValue ShowBoxes{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
ShowBoxes 0
defaultAttributeValue Sides{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Int -> Attribute
Sides 4
defaultAttributeValue Skew{}               = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Skew 0.0
defaultAttributeValue Smoothing{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ SmoothType -> Attribute
Smoothing SmoothType
NoSmooth
defaultAttributeValue SortV{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Word16 -> Attribute
SortV 0
defaultAttributeValue StyleSheet{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
StyleSheet ""
defaultAttributeValue TailURL{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
TailURL ""
defaultAttributeValue TailClip{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Bool -> Attribute
TailClip Bool
True
defaultAttributeValue TailLabel{}          = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Label -> Attribute
TailLabel (Text -> Label
StrLabel "")
defaultAttributeValue TailPort{}           = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ PortPos -> Attribute
TailPort (CompassPoint -> PortPos
CompassPoint CompassPoint
CenterPoint)
defaultAttributeValue TailTarget{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
TailTarget ""
defaultAttributeValue TailTooltip{}        = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
TailTooltip ""
defaultAttributeValue Target{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Target ""
defaultAttributeValue Tooltip{}            = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Text -> Attribute
Tooltip ""
defaultAttributeValue VoroMargin{}         = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
VoroMargin 0.05
defaultAttributeValue Weight{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Number -> Attribute
Weight (Int -> Number
Int 1)
defaultAttributeValue Width{}              = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Double -> Attribute
Width 0.75
defaultAttributeValue XLabel{}             = Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just (Attribute -> Maybe Attribute) -> Attribute -> Maybe Attribute
forall a b. (a -> b) -> a -> b
$ Label -> Attribute
XLabel (Text -> Label
StrLabel "")
defaultAttributeValue _                    = Maybe Attribute
forall a. Maybe a
Nothing

-- | Determine if the provided 'Text' value is a valid name for an 'UnknownAttribute'.
validUnknown     :: AttributeName -> Bool
validUnknown :: Text -> Bool
validUnknown txt :: Text
txt = Text -> Text
T.toLower Text
txt Text -> Set Text -> Bool
forall a. Ord a => a -> Set a -> Bool
`S.notMember` Set Text
names
                   Bool -> Bool -> Bool
&& Text -> Bool
isIDString Text
txt
  where
    names :: Set Text
names = ([Text] -> Set Text
forall a. Ord a => [a] -> Set a
S.fromList ([Text] -> Set Text) -> ([Text] -> [Text]) -> [Text] -> Set Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Text) -> [Text] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Text -> Text
T.toLower
             ([Text] -> Set Text) -> [Text] -> Set Text
forall a b. (a -> b) -> a -> b
$ [ "Damping"
               , "K"
               , "URL"
               , "href"
               , "area"
               , "arrowhead"
               , "arrowsize"
               , "arrowtail"
               , "_background"
               , "bb"
               , "bgcolor"
               , "center"
               , "clusterrank"
               , "color"
               , "colorscheme"
               , "comment"
               , "compound"
               , "concentrate"
               , "constraint"
               , "decorate"
               , "defaultdist"
               , "dim"
               , "dimen"
               , "dir"
               , "diredgeconstraints"
               , "distortion"
               , "dpi"
               , "resolution"
               , "edgeURL"
               , "edgehref"
               , "edgetarget"
               , "edgetooltip"
               , "epsilon"
               , "esep"
               , "fillcolor"
               , "fixedsize"
               , "fontcolor"
               , "fontname"
               , "fontnames"
               , "fontpath"
               , "fontsize"
               , "forcelabels"
               , "gradientangle"
               , "group"
               , "headURL"
               , "headhref"
               , "head_lp"
               , "headclip"
               , "headlabel"
               , "headport"
               , "headtarget"
               , "headtooltip"
               , "height"
               , "id"
               , "image"
               , "imagepath"
               , "imagescale"
               , "inputscale"
               , "label"
               , "labelURL"
               , "labelhref"
               , "label_scheme"
               , "labelangle"
               , "labeldistance"
               , "labelfloat"
               , "labelfontcolor"
               , "labelfontname"
               , "labelfontsize"
               , "labeljust"
               , "labelloc"
               , "labeltarget"
               , "labeltooltip"
               , "landscape"
               , "layer"
               , "layerlistsep"
               , "layers"
               , "layerselect"
               , "layersep"
               , "layout"
               , "len"
               , "levels"
               , "levelsgap"
               , "lhead"
               , "LHeight"
               , "lp"
               , "ltail"
               , "lwidth"
               , "margin"
               , "maxiter"
               , "mclimit"
               , "mindist"
               , "minlen"
               , "mode"
               , "model"
               , "mosek"
               , "nodesep"
               , "nojustify"
               , "normalize"
               , "notranslate"
               , "nslimit"
               , "nslimit1"
               , "ordering"
               , "orientation"
               , "outputorder"
               , "overlap"
               , "overlap_scaling"
               , "overlap_shrink"
               , "pack"
               , "packmode"
               , "pad"
               , "page"
               , "pagedir"
               , "pencolor"
               , "penwidth"
               , "peripheries"
               , "pin"
               , "pos"
               , "quadtree"
               , "quantum"
               , "rank"
               , "rankdir"
               , "ranksep"
               , "ratio"
               , "rects"
               , "regular"
               , "remincross"
               , "repulsiveforce"
               , "root"
               , "rotate"
               , "rotation"
               , "samehead"
               , "sametail"
               , "samplepoints"
               , "scale"
               , "searchsize"
               , "sep"
               , "shape"
               , "showboxes"
               , "sides"
               , "size"
               , "skew"
               , "smoothing"
               , "sortv"
               , "splines"
               , "start"
               , "style"
               , "stylesheet"
               , "tailURL"
               , "tailhref"
               , "tail_lp"
               , "tailclip"
               , "taillabel"
               , "tailport"
               , "tailtarget"
               , "tailtooltip"
               , "target"
               , "tooltip"
               , "truecolor"
               , "vertices"
               , "viewport"
               , "voro_margin"
               , "weight"
               , "width"
               , "xdotversion"
               , "xlabel"
               , "xlp"
               , "charset" -- Defined upstream, just not used here.
               ])
            Set Text -> Set Text -> Set Text
forall a. Ord a => Set a -> Set a -> Set a
`S.union`
            Set Text
keywords
{- Delete to here -}

-- | Remove attributes that we don't want to consider:
--
--   * Those that are defaults
--   * colorscheme (as the colors embed it anyway)
rmUnwantedAttributes :: Attributes -> Attributes
rmUnwantedAttributes :: [Attribute] -> [Attribute]
rmUnwantedAttributes = (Attribute -> Bool) -> [Attribute] -> [Attribute]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (Attribute -> Bool) -> Attribute -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (((Attribute -> Bool) -> Bool) -> [Attribute -> Bool] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
`any` [Attribute -> Bool]
tests) (((Attribute -> Bool) -> Bool) -> Bool)
-> (Attribute -> (Attribute -> Bool) -> Bool) -> Attribute -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Attribute -> Bool) -> Attribute -> Bool)
-> Attribute -> (Attribute -> Bool) -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Attribute -> Bool) -> Attribute -> Bool
forall a b. (a -> b) -> a -> b
($))
  where
    tests :: [Attribute -> Bool]
tests = [Attribute -> Bool
isDefault, Attribute -> Bool
isColorScheme]

    isDefault :: Attribute -> Bool
isDefault a :: Attribute
a = Bool -> (Attribute -> Bool) -> Maybe Attribute -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (Attribute
aAttribute -> Attribute -> Bool
forall a. Eq a => a -> a -> Bool
==) (Maybe Attribute -> Bool) -> Maybe Attribute -> Bool
forall a b. (a -> b) -> a -> b
$ Attribute -> Maybe Attribute
defaultAttributeValue Attribute
a

    isColorScheme :: Attribute -> Bool
isColorScheme ColorScheme{} = Bool
True
    isColorScheme _             = Bool
False

-- -----------------------------------------------------------------------------
-- These parsing combinators are defined here for customisation purposes.

parseField       :: (ParseDot a) => (a -> Attribute) -> String
                    -> [(String, Parse Attribute)]
parseField :: (a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField c :: a -> Attribute
c fld :: String
fld = [(String
fld, String -> (a -> Attribute) -> Parse Attribute
forall a.
ParseDot a =>
String -> (a -> Attribute) -> Parse Attribute
liftEqParse String
fld a -> Attribute
c)]

parseFields   :: (ParseDot a) => (a -> Attribute) -> [String]
                 -> [(String, Parse Attribute)]
parseFields :: (a -> Attribute) -> [String] -> [(String, Parse Attribute)]
parseFields c :: a -> Attribute
c = (String -> [(String, Parse Attribute)])
-> [String] -> [(String, Parse Attribute)]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ((a -> Attribute) -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> String -> [(String, Parse Attribute)]
parseField a -> Attribute
c)

parseFieldBool :: (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool :: (Bool -> Attribute) -> String -> [(String, Parse Attribute)]
parseFieldBool = ((Bool -> Attribute)
-> Bool -> String -> [(String, Parse Attribute)]
forall a.
ParseDot a =>
(a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
`parseFieldDef` Bool
True)

-- | For 'Bool'-like data structures where the presence of the field
--   name without a value implies a default value.
parseFieldDef         :: (ParseDot a) => (a -> Attribute) -> a -> String
                         -> [(String, Parse Attribute)]
parseFieldDef :: (a -> Attribute) -> a -> String -> [(String, Parse Attribute)]
parseFieldDef c :: a -> Attribute
c d :: a
d fld :: String
fld = [(String
fld, Parse Attribute
p)]
  where
    p :: Parse Attribute
p = String -> (a -> Attribute) -> Parse Attribute
forall a.
ParseDot a =>
String -> (a -> Attribute) -> Parse Attribute
liftEqParse String
fld a -> Attribute
c
        Parse Attribute -> Parse Attribute -> Parse Attribute
forall s a. Parser s a -> Parser s a -> Parser s a
`onFail`
        do Maybe Char
nxt <- Parser GraphvizState Char -> Parser GraphvizState (Maybe Char)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser GraphvizState Char -> Parser GraphvizState (Maybe Char))
-> Parser GraphvizState Char -> Parser GraphvizState (Maybe Char)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Parser GraphvizState Char
forall s. (Char -> Bool) -> Parser s Char
satisfy Char -> Bool
restIDString
           Parse Attribute -> Parse Attribute -> Bool -> Parse Attribute
forall a. a -> a -> Bool -> a
bool (String -> Parse Attribute
forall (m :: * -> *) a. MonadFail m => String -> m a
fail "Not actually the field you were after")
                (Attribute -> Parse Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return (Attribute -> Parse Attribute) -> Attribute -> Parse Attribute
forall a b. (a -> b) -> a -> b
$ a -> Attribute
c a
d)
                (Maybe Char -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Char
nxt)

-- | Attempt to parse the @\"=value\"@ part of a @key=value@ pair.  If
--   there is an equal sign but the @value@ part doesn't parse, throw
--   an un-recoverable error.
liftEqParse :: (ParseDot a) => String -> (a -> Attribute) -> Parse Attribute
liftEqParse :: String -> (a -> Attribute) -> Parse Attribute
liftEqParse k :: String
k c :: a -> Attribute
c = do Bool
pStrict <- (GraphvizState -> Bool) -> Parser GraphvizState Bool
forall (m :: * -> *) a.
GraphvizStateM m =>
(GraphvizState -> a) -> m a
getsGS GraphvizState -> Bool
parseStrictly
                     let adjErr :: Parser GraphvizState a -> ShowS -> Parser GraphvizState a
adjErr = (Parser GraphvizState a -> ShowS -> Parser GraphvizState a)
-> (Parser GraphvizState a -> ShowS -> Parser GraphvizState a)
-> Bool
-> Parser GraphvizState a
-> ShowS
-> Parser GraphvizState a
forall a. a -> a -> Bool -> a
bool Parser GraphvizState a -> ShowS -> Parser GraphvizState a
forall (p :: * -> *) a. Commitment p => p a -> ShowS -> p a
adjustErr Parser GraphvizState a -> ShowS -> Parser GraphvizState a
forall (p :: * -> *) a. PolyParse p => p a -> ShowS -> p a
adjustErrBad Bool
pStrict
                     Parse ()
parseEq
                       Parse () -> Parse Attribute -> Parse Attribute
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ( Parse Attribute -> Parse Attribute
hasDef ((a -> Attribute) -> Parser GraphvizState a -> Parse Attribute
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Attribute
c Parser GraphvizState a
forall a. ParseDot a => Parse a
parse)
                            Parse Attribute -> ShowS -> Parse Attribute
forall a. Parser GraphvizState a -> ShowS -> Parser GraphvizState a
`adjErr`
                            (("Unable to parse key=value with key of " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
k
                              String -> ShowS
forall a. [a] -> [a] -> [a]
++ "\n\t") String -> ShowS
forall a. [a] -> [a] -> [a]
++)
                          )
  where
    hasDef :: Parse Attribute -> Parse Attribute
hasDef p :: Parse Attribute
p = Parse Attribute
-> (Attribute -> Parse Attribute)
-> Maybe Attribute
-> Parse Attribute
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Parse Attribute
p (Parse Attribute -> Parse Attribute -> Parse Attribute
forall s a. Parser s a -> Parser s a -> Parser s a
onFail Parse Attribute
p (Parse Attribute -> Parse Attribute)
-> (Attribute -> Parse Attribute) -> Attribute -> Parse Attribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Attribute -> String -> Parse Attribute
forall a. a -> String -> Parse a
`stringRep` "\"\""))
               (Maybe Attribute -> Parse Attribute)
-> (Attribute -> Maybe Attribute) -> Attribute -> Parse Attribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Attribute -> Maybe Attribute
defaultAttributeValue (Attribute -> Parse Attribute) -> Attribute -> Parse Attribute
forall a b. (a -> b) -> a -> b
$ a -> Attribute
c a
forall a. HasCallStack => a
undefined

-- -----------------------------------------------------------------------------

{- | If performing any custom pre-/post-processing on Dot code, you
     may wish to utilise some custom 'Attributes'.  These are wrappers
     around the 'UnknownAttribute' constructor (and thus 'CustomAttribute'
     is just an alias for 'Attribute').

     You should ensure that 'validUnknown' is 'True' for any potential
     custom attribute name.

-}
type CustomAttribute = Attribute

-- | Create a custom attribute.
customAttribute :: AttributeName -> Text -> CustomAttribute
customAttribute :: Text -> Text -> Attribute
customAttribute = Text -> Text -> Attribute
UnknownAttribute

-- | Determines whether or not this is a custom attribute.
isCustom                    :: Attribute -> Bool
isCustom :: Attribute -> Bool
isCustom UnknownAttribute{} = Bool
True
isCustom _                  = Bool
False

isSpecifiedCustom :: AttributeName -> Attribute -> Bool
isSpecifiedCustom :: Text -> Attribute -> Bool
isSpecifiedCustom nm :: Text
nm (UnknownAttribute nm' :: Text
nm' _) = Text
nm Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
nm'
isSpecifiedCustom _  _                        = Bool
False

-- | The value of a custom attribute.  Will throw a
--   'GraphvizException' if the provided 'Attribute' isn't a custom
--   one.
customValue :: CustomAttribute -> Text
customValue :: Attribute -> Text
customValue (UnknownAttribute _ v :: Text
v) = Text
v
customValue attr :: Attribute
attr                   = GraphvizException -> Text
forall a e. Exception e => e -> a
throw (GraphvizException -> Text)
-> (Text -> GraphvizException) -> Text -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> GraphvizException
NotCustomAttr (String -> GraphvizException)
-> (Text -> String) -> Text -> GraphvizException
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack
                                     (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Attribute -> Text
forall a. PrintDot a => a -> Text
printIt Attribute
attr

-- | The name of a custom attribute.  Will throw a
--   'GraphvizException' if the provided 'Attribute' isn't a custom
--   one.
customName :: CustomAttribute -> AttributeName
customName :: Attribute -> Text
customName (UnknownAttribute nm :: Text
nm _) = Text
nm
customName attr :: Attribute
attr                    = GraphvizException -> Text
forall a e. Exception e => e -> a
throw (GraphvizException -> Text)
-> (Text -> GraphvizException) -> Text -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> GraphvizException
NotCustomAttr (String -> GraphvizException)
-> (Text -> String) -> Text -> GraphvizException
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack
                                      (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Attribute -> Text
forall a. PrintDot a => a -> Text
printIt Attribute
attr

-- | Returns all custom attributes and the list of non-custom Attributes.
findCustoms :: Attributes -> ([CustomAttribute], Attributes)
findCustoms :: [Attribute] -> ([Attribute], [Attribute])
findCustoms = (Attribute -> Bool) -> [Attribute] -> ([Attribute], [Attribute])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition Attribute -> Bool
isCustom

-- | Find the (first instance of the) specified custom attribute and
--   returns it along with all other Attributes.
findSpecifiedCustom :: AttributeName -> Attributes
                       -> Maybe (CustomAttribute, Attributes)
findSpecifiedCustom :: Text -> [Attribute] -> Maybe (Attribute, [Attribute])
findSpecifiedCustom nm :: Text
nm attrs :: [Attribute]
attrs
  = case (Attribute -> Bool) -> [Attribute] -> ([Attribute], [Attribute])
forall a. (a -> Bool) -> [a] -> ([a], [a])
break (Text -> Attribute -> Bool
isSpecifiedCustom Text
nm) [Attribute]
attrs of
      (bf :: [Attribute]
bf,cust :: Attribute
cust:aft :: [Attribute]
aft) -> (Attribute, [Attribute]) -> Maybe (Attribute, [Attribute])
forall a. a -> Maybe a
Just (Attribute
cust, [Attribute]
bf [Attribute] -> [Attribute] -> [Attribute]
forall a. [a] -> [a] -> [a]
++ [Attribute]
aft)
      _             -> Maybe (Attribute, [Attribute])
forall a. Maybe a
Nothing

-- | Delete all custom attributes (actually, this will delete all
--   'UnknownAttribute' values; as such it can also be used to remove
--   legacy attributes).
deleteCustomAttributes :: Attributes -> Attributes
deleteCustomAttributes :: [Attribute] -> [Attribute]
deleteCustomAttributes = (Attribute -> Bool) -> [Attribute] -> [Attribute]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (Attribute -> Bool) -> Attribute -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Attribute -> Bool
isCustom)

-- | Removes all instances of the specified custom attribute.
deleteSpecifiedCustom :: AttributeName -> Attributes -> Attributes
deleteSpecifiedCustom :: Text -> [Attribute] -> [Attribute]
deleteSpecifiedCustom nm :: Text
nm = (Attribute -> Bool) -> [Attribute] -> [Attribute]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (Attribute -> Bool) -> Attribute -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Attribute -> Bool
isSpecifiedCustom Text
nm)