    {-# LANGUAGE CPP, OverloadedStrings #-}
    {-# OPTIONS_HADDOCK hide #-}
    {- |
       Module      : Data.GraphViz.Attributes.Arrows
       Description : Arrow types
       Copyright   : (c) Ivan Lazar Miljenovic
       License     : 3-Clause BSD-style
       Maintainer  : Ivan.Miljenovic@gmail.com

     -}
    module Data.GraphViz.Attributes.Arrows where

    import Data.GraphViz.Internal.Util (bool)
    import Data.GraphViz.Parsing
    import Data.GraphViz.Printing

    import Data.Maybe (isJust)

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

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

    -- | /Dot/ has a basic grammar of arrow shapes which allows usage of
    --   up to 1,544,761 different shapes from 9 different basic
    --   'ArrowShape's.  Note that whilst an explicit list is used in the
    --   definition of 'ArrowType', there must be at least one tuple and a
    --   maximum of 4 (since that is what is required by Dot).  For more
    --   information, see: <http://graphviz.org/doc/info/arrows.html>
    --
    --   The 19 basic arrows shown on the overall attributes page have
    --   been defined below as a convenience.  Parsing of the 5
    --   backward-compatible special cases is also supported.
    newtype ArrowType = AType [(ArrowModifier, ArrowShape)]
        deriving (ArrowType -> ArrowType -> Bool
    (ArrowType -> ArrowType -> Bool)
    -> (ArrowType -> ArrowType -> Bool) -> Eq ArrowType
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArrowType -> ArrowType -> Bool
    == :: ArrowType -> ArrowType -> Bool
    $c/= :: ArrowType -> ArrowType -> Bool
    /= :: ArrowType -> ArrowType -> Bool
    Eq, Eq ArrowType
    Eq ArrowType =>
    (ArrowType -> ArrowType -> Ordering)
    -> (ArrowType -> ArrowType -> Bool)
    -> (ArrowType -> ArrowType -> Bool)
    -> (ArrowType -> ArrowType -> Bool)
    -> (ArrowType -> ArrowType -> Bool)
    -> (ArrowType -> ArrowType -> ArrowType)
    -> (ArrowType -> ArrowType -> ArrowType)
    -> Ord ArrowType
    ArrowType -> ArrowType -> Bool
    ArrowType -> ArrowType -> Ordering
    ArrowType -> ArrowType -> ArrowType
    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
    $ccompare :: ArrowType -> ArrowType -> Ordering
    compare :: ArrowType -> ArrowType -> Ordering
    $c< :: ArrowType -> ArrowType -> Bool
    < :: ArrowType -> ArrowType -> Bool
    $c<= :: ArrowType -> ArrowType -> Bool
    <= :: ArrowType -> ArrowType -> Bool
    $c> :: ArrowType -> ArrowType -> Bool
    > :: ArrowType -> ArrowType -> Bool
    $c>= :: ArrowType -> ArrowType -> Bool
    >= :: ArrowType -> ArrowType -> Bool
    $cmax :: ArrowType -> ArrowType -> ArrowType
    max :: ArrowType -> ArrowType -> ArrowType
    $cmin :: ArrowType -> ArrowType -> ArrowType
    min :: ArrowType -> ArrowType -> ArrowType
    Ord, Int -> ArrowType -> ShowS
    [ArrowType] -> ShowS
    ArrowType -> String
    (Int -> ArrowType -> ShowS)
    -> (ArrowType -> String)
    -> ([ArrowType] -> ShowS)
    -> Show ArrowType
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArrowType -> ShowS
    showsPrec :: Int -> ArrowType -> ShowS
    $cshow :: ArrowType -> String
    show :: ArrowType -> String
    $cshowList :: [ArrowType] -> ShowS
    showList :: [ArrowType] -> ShowS
    Show, ReadPrec [ArrowType]
    ReadPrec ArrowType
    Int -> ReadS ArrowType
    ReadS [ArrowType]
    (Int -> ReadS ArrowType)
    -> ReadS [ArrowType]
    -> ReadPrec ArrowType
    -> ReadPrec [ArrowType]
    -> Read ArrowType
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ArrowType
    readsPrec :: Int -> ReadS ArrowType
    $creadList :: ReadS [ArrowType]
    readList :: ReadS [ArrowType]
    $creadPrec :: ReadPrec ArrowType
    readPrec :: ReadPrec ArrowType
    $creadListPrec :: ReadPrec [ArrowType]
    readListPrec :: ReadPrec [ArrowType]
    Read)

    -- Used for default
    normal :: ArrowType
    normal :: ArrowType
    normal = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [(ArrowModifier
    noMods, ArrowShape
    Normal)]

    -- Used for backward-compatible parsing
    eDiamond, openArr, halfOpen, emptyArr, invEmpty :: ArrowType

    eDiamond :: ArrowType
    eDiamond = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [(ArrowModifier
    openMod, ArrowShape
    Diamond)]
    openArr :: ArrowType
    openArr = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [(ArrowModifier
    noMods, ArrowShape
    Vee)]
    halfOpen :: ArrowType
    halfOpen = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [(ArrowFill -> ArrowSide -> ArrowModifier
    ArrMod ArrowFill
    FilledArrow ArrowSide
    LeftSide, ArrowShape
    Vee)]
    emptyArr :: ArrowType
    emptyArr = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [(ArrowModifier
    openMod, ArrowShape
    Normal)]
    invEmpty :: ArrowType
    invEmpty = [(ArrowModifier, ArrowShape)] -> ArrowType
    AType [ (ArrowModifier
    noMods, ArrowShape
    Inv)
                     , (ArrowModifier
    openMod, ArrowShape
    Normal)]

    instance PrintDot ArrowType where
      unqtDot :: ArrowType -> DotCode
    unqtDot (AType [(ArrowModifier, ArrowShape)]
    mas) = DotCodeM [Doc] -> DotCode
    forall (m :: * -> *). Functor m => m [Doc] -> m Doc
    hcat (DotCodeM [Doc] -> DotCode) -> DotCodeM [Doc] -> DotCode
    forall a b. (a -> b) -> a -> b
    $ ((ArrowModifier, ArrowShape) -> DotCode)
    -> [(ArrowModifier, ArrowShape)] -> DotCodeM [Doc]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    (a -> m b) -> t a -> m (t b)
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
    mapM (ArrowModifier, ArrowShape) -> DotCode
    forall {a} {a}. (PrintDot a, PrintDot a) => (a, a) -> DotCode
    appMod [(ArrowModifier, ArrowShape)]
    mas
        where
          appMod :: (a, a) -> DotCode
    appMod (a
    m, a
    a) = a -> DotCode
    forall a. PrintDot a => a -> DotCode
    unqtDot a
    m DotCode -> DotCode -> DotCode
    forall a. Semigroup a => a -> a -> a
    <> a -> DotCode
    forall a. PrintDot a => a -> DotCode
    unqtDot a
    a

    instance ParseDot ArrowType where
      parseUnqt :: Parse ArrowType
    parseUnqt = Parse ArrowType
    specialArrowParse
                  Parse ArrowType -> Parse ArrowType -> Parse ArrowType
    forall s a. Parser s a -> Parser s a -> Parser s a
    `onFail`
                  ([(ArrowModifier, ArrowShape)] -> ArrowType
    AType ([(ArrowModifier, ArrowShape)] -> ArrowType)
    -> Parser GraphvizState [(ArrowModifier, ArrowShape)]
    -> Parse ArrowType
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Parser GraphvizState (ArrowModifier, ArrowShape)
    -> Parser GraphvizState [(ArrowModifier, ArrowShape)]
    forall (p :: * -> *) a. PolyParse p => p a -> p [a]
    many1 ((ArrowModifier -> ArrowShape -> (ArrowModifier, ArrowShape))
    -> Parser GraphvizState ArrowModifier
    -> Parser GraphvizState ArrowShape
    -> Parser GraphvizState (ArrowModifier, ArrowShape)
    forall a b c.
    (a -> b -> c)
    -> Parser GraphvizState a
    -> Parser GraphvizState b
    -> Parser GraphvizState c
    forall (f :: * -> *) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 (,) Parser GraphvizState ArrowModifier
    forall a. ParseDot a => Parse a
    parseUnqt Parser GraphvizState ArrowShape
    forall a. ParseDot a => Parse a
    parseUnqt))

    specialArrowParse :: Parse ArrowType
    specialArrowParse :: Parse ArrowType
    specialArrowParse = [(String, ArrowType)] -> Parse ArrowType
    forall a. [(String, a)] -> Parse a
    stringValue [ (String
    "ediamond", ArrowType
    eDiamond)
                                    , (String
    "open", ArrowType
    openArr)
                                    , (String
    "halfopen", ArrowType
    halfOpen)
                                    , (String
    "empty", ArrowType
    emptyArr)
                                    , (String
    "invempty", ArrowType
    invEmpty)
                                    ]

    data ArrowShape = Box
                    | Crow
                    | Diamond
                    | DotArrow
                    | Inv
                    | NoArrow
                    | Normal
                    | Tee
                    | Vee
                    deriving (ArrowShape -> ArrowShape -> Bool
    (ArrowShape -> ArrowShape -> Bool)
    -> (ArrowShape -> ArrowShape -> Bool) -> Eq ArrowShape
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArrowShape -> ArrowShape -> Bool
    == :: ArrowShape -> ArrowShape -> Bool
    $c/= :: ArrowShape -> ArrowShape -> Bool
    /= :: ArrowShape -> ArrowShape -> Bool
    Eq, Eq ArrowShape
    Eq ArrowShape =>
    (ArrowShape -> ArrowShape -> Ordering)
    -> (ArrowShape -> ArrowShape -> Bool)
    -> (ArrowShape -> ArrowShape -> Bool)
    -> (ArrowShape -> ArrowShape -> Bool)
    -> (ArrowShape -> ArrowShape -> Bool)
    -> (ArrowShape -> ArrowShape -> ArrowShape)
    -> (ArrowShape -> ArrowShape -> ArrowShape)
    -> Ord ArrowShape
    ArrowShape -> ArrowShape -> Bool
    ArrowShape -> ArrowShape -> Ordering
    ArrowShape -> ArrowShape -> ArrowShape
    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
    $ccompare :: ArrowShape -> ArrowShape -> Ordering
    compare :: ArrowShape -> ArrowShape -> Ordering
    $c< :: ArrowShape -> ArrowShape -> Bool
    < :: ArrowShape -> ArrowShape -> Bool
    $c<= :: ArrowShape -> ArrowShape -> Bool
    <= :: ArrowShape -> ArrowShape -> Bool
    $c> :: ArrowShape -> ArrowShape -> Bool
    > :: ArrowShape -> ArrowShape -> Bool
    $c>= :: ArrowShape -> ArrowShape -> Bool
    >= :: ArrowShape -> ArrowShape -> Bool
    $cmax :: ArrowShape -> ArrowShape -> ArrowShape
    max :: ArrowShape -> ArrowShape -> ArrowShape
    $cmin :: ArrowShape -> ArrowShape -> ArrowShape
    min :: ArrowShape -> ArrowShape -> ArrowShape
    Ord, ArrowShape
    ArrowShape -> ArrowShape -> Bounded ArrowShape
    forall a. a -> a -> Bounded a
    $cminBound :: ArrowShape
    minBound :: ArrowShape
    $cmaxBound :: ArrowShape
    maxBound :: ArrowShape
    Bounded, Int -> ArrowShape
    ArrowShape -> Int
    ArrowShape -> [ArrowShape]
    ArrowShape -> ArrowShape
    ArrowShape -> ArrowShape -> [ArrowShape]
    ArrowShape -> ArrowShape -> ArrowShape -> [ArrowShape]
    (ArrowShape -> ArrowShape)
    -> (ArrowShape -> ArrowShape)
    -> (Int -> ArrowShape)
    -> (ArrowShape -> Int)
    -> (ArrowShape -> [ArrowShape])
    -> (ArrowShape -> ArrowShape -> [ArrowShape])
    -> (ArrowShape -> ArrowShape -> [ArrowShape])
    -> (ArrowShape -> ArrowShape -> ArrowShape -> [ArrowShape])
    -> Enum ArrowShape
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: ArrowShape -> ArrowShape
    succ :: ArrowShape -> ArrowShape
    $cpred :: ArrowShape -> ArrowShape
    pred :: ArrowShape -> ArrowShape
    $ctoEnum :: Int -> ArrowShape
    toEnum :: Int -> ArrowShape
    $cfromEnum :: ArrowShape -> Int
    fromEnum :: ArrowShape -> Int
    $cenumFrom :: ArrowShape -> [ArrowShape]
    enumFrom :: ArrowShape -> [ArrowShape]
    $cenumFromThen :: ArrowShape -> ArrowShape -> [ArrowShape]
    enumFromThen :: ArrowShape -> ArrowShape -> [ArrowShape]
    $cenumFromTo :: ArrowShape -> ArrowShape -> [ArrowShape]
    enumFromTo :: ArrowShape -> ArrowShape -> [ArrowShape]
    $cenumFromThenTo :: ArrowShape -> ArrowShape -> ArrowShape -> [ArrowShape]
    enumFromThenTo :: ArrowShape -> ArrowShape -> ArrowShape -> [ArrowShape]
    Enum, Int -> ArrowShape -> ShowS
    [ArrowShape] -> ShowS
    ArrowShape -> String
    (Int -> ArrowShape -> ShowS)
    -> (ArrowShape -> String)
    -> ([ArrowShape] -> ShowS)
    -> Show ArrowShape
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArrowShape -> ShowS
    showsPrec :: Int -> ArrowShape -> ShowS
    $cshow :: ArrowShape -> String
    show :: ArrowShape -> String
    $cshowList :: [ArrowShape] -> ShowS
    showList :: [ArrowShape] -> ShowS
    Show, ReadPrec [ArrowShape]
    ReadPrec ArrowShape
    Int -> ReadS ArrowShape
    ReadS [ArrowShape]
    (Int -> ReadS ArrowShape)
    -> ReadS [ArrowShape]
    -> ReadPrec ArrowShape
    -> ReadPrec [ArrowShape]
    -> Read ArrowShape
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ArrowShape
    readsPrec :: Int -> ReadS ArrowShape
    $creadList :: ReadS [ArrowShape]
    readList :: ReadS [ArrowShape]
    $creadPrec :: ReadPrec ArrowShape
    readPrec :: ReadPrec ArrowShape
    $creadListPrec :: ReadPrec [ArrowShape]
    readListPrec :: ReadPrec [ArrowShape]
    Read)

    instance PrintDot ArrowShape where
      unqtDot :: ArrowShape -> DotCode
    unqtDot ArrowShape
    Box      = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "box"
      unqtDot ArrowShape
    Crow     = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "crow"
      unqtDot ArrowShape
    Diamond  = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "diamond"
      unqtDot ArrowShape
    DotArrow = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "dot"
      unqtDot ArrowShape
    Inv      = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "inv"
      unqtDot ArrowShape
    NoArrow  = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "none"
      unqtDot ArrowShape
    Normal   = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "normal"
      unqtDot ArrowShape
    Tee      = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "tee"
      unqtDot ArrowShape
    Vee      = Text -> DotCode
    forall (m :: * -> *). Applicative m => Text -> m Doc
    text Text
    "vee"

    instance ParseDot ArrowShape where
      parseUnqt :: Parser GraphvizState ArrowShape
    parseUnqt = [(String, ArrowShape)] -> Parser GraphvizState ArrowShape
    forall a. [(String, a)] -> Parse a
    stringValue [ (String
    "box", ArrowShape
    Box)
                              , (String
    "crow", ArrowShape
    Crow)
                              , (String
    "diamond", ArrowShape
    Diamond)
                              , (String
    "dot", ArrowShape
    DotArrow)
                              , (String
    "inv", ArrowShape
    Inv)
                              , (String
    "none", ArrowShape
    NoArrow)
                              , (String
    "normal", ArrowShape
    Normal)
                              , (String
    "tee", ArrowShape
    Tee)
                              , (String
    "vee", ArrowShape
    Vee)
                              ]

    -- | What modifications to apply to an 'ArrowShape'.
    data ArrowModifier = ArrMod { ArrowModifier -> ArrowFill
    arrowFill :: ArrowFill
                                , ArrowModifier -> ArrowSide
    arrowSide :: ArrowSide
                                }
                       deriving (ArrowModifier -> ArrowModifier -> Bool
    (ArrowModifier -> ArrowModifier -> Bool)
    -> (ArrowModifier -> ArrowModifier -> Bool) -> Eq ArrowModifier
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArrowModifier -> ArrowModifier -> Bool
    == :: ArrowModifier -> ArrowModifier -> Bool
    $c/= :: ArrowModifier -> ArrowModifier -> Bool
    /= :: ArrowModifier -> ArrowModifier -> Bool
    Eq, Eq ArrowModifier
    Eq ArrowModifier =>
    (ArrowModifier -> ArrowModifier -> Ordering)
    -> (ArrowModifier -> ArrowModifier -> Bool)
    -> (ArrowModifier -> ArrowModifier -> Bool)
    -> (ArrowModifier -> ArrowModifier -> Bool)
    -> (ArrowModifier -> ArrowModifier -> Bool)
    -> (ArrowModifier -> ArrowModifier -> ArrowModifier)
    -> (ArrowModifier -> ArrowModifier -> ArrowModifier)
    -> Ord ArrowModifier
    ArrowModifier -> ArrowModifier -> Bool
    ArrowModifier -> ArrowModifier -> Ordering
    ArrowModifier -> ArrowModifier -> ArrowModifier
    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
    $ccompare :: ArrowModifier -> ArrowModifier -> Ordering
    compare :: ArrowModifier -> ArrowModifier -> Ordering
    $c< :: ArrowModifier -> ArrowModifier -> Bool
    < :: ArrowModifier -> ArrowModifier -> Bool
    $c<= :: ArrowModifier -> ArrowModifier -> Bool
    <= :: ArrowModifier -> ArrowModifier -> Bool
    $c> :: ArrowModifier -> ArrowModifier -> Bool
    > :: ArrowModifier -> ArrowModifier -> Bool
    $c>= :: ArrowModifier -> ArrowModifier -> Bool
    >= :: ArrowModifier -> ArrowModifier -> Bool
    $cmax :: ArrowModifier -> ArrowModifier -> ArrowModifier
    max :: ArrowModifier -> ArrowModifier -> ArrowModifier
    $cmin :: ArrowModifier -> ArrowModifier -> ArrowModifier
    min :: ArrowModifier -> ArrowModifier -> ArrowModifier
    Ord, Int -> ArrowModifier -> ShowS
    [ArrowModifier] -> ShowS
    ArrowModifier -> String
    (Int -> ArrowModifier -> ShowS)
    -> (ArrowModifier -> String)
    -> ([ArrowModifier] -> ShowS)
    -> Show ArrowModifier
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArrowModifier -> ShowS
    showsPrec :: Int -> ArrowModifier -> ShowS
    $cshow :: ArrowModifier -> String
    show :: ArrowModifier -> String
    $cshowList :: [ArrowModifier] -> ShowS
    showList :: [ArrowModifier] -> ShowS
    Show, ReadPrec [ArrowModifier]
    ReadPrec ArrowModifier
    Int -> ReadS ArrowModifier
    ReadS [ArrowModifier]
    (Int -> ReadS ArrowModifier)
    -> ReadS [ArrowModifier]
    -> ReadPrec ArrowModifier
    -> ReadPrec [ArrowModifier]
    -> Read ArrowModifier
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ArrowModifier
    readsPrec :: Int -> ReadS ArrowModifier
    $creadList :: ReadS [ArrowModifier]
    readList :: ReadS [ArrowModifier]
    $creadPrec :: ReadPrec ArrowModifier
    readPrec :: ReadPrec ArrowModifier
    $creadListPrec :: ReadPrec [ArrowModifier]
    readListPrec :: ReadPrec [ArrowModifier]
    Read)

    -- | Apply no modifications to an 'ArrowShape'.
    noMods :: ArrowModifier
    noMods :: ArrowModifier
    noMods = ArrowFill -> ArrowSide -> ArrowModifier
    ArrMod ArrowFill
    FilledArrow ArrowSide
    BothSides

    -- | 'OpenArrow' and 'BothSides'
    openMod :: ArrowModifier
    openMod :: ArrowModifier
    openMod = ArrowFill -> ArrowSide -> ArrowModifier
    ArrMod ArrowFill
    OpenArrow ArrowSide
    BothSides

    instance PrintDot ArrowModifier where
      unqtDot :: ArrowModifier -> DotCode
    unqtDot (ArrMod ArrowFill
    f ArrowSide
    s) = ArrowFill -> DotCode
    forall a. PrintDot a => a -> DotCode
    unqtDot ArrowFill
    f DotCode -> DotCode -> DotCode
    forall a. Semigroup a => a -> a -> a
    <> ArrowSide -> DotCode
    forall a. PrintDot a => a -> DotCode
    unqtDot ArrowSide
    s

    instance ParseDot ArrowModifier where
      parseUnqt :: Parser GraphvizState ArrowModifier
    parseUnqt = (ArrowFill -> ArrowSide -> ArrowModifier)
    -> Parser GraphvizState ArrowFill
    -> Parser GraphvizState ArrowSide
    -> Parser GraphvizState ArrowModifier
    forall a b c.
    (a -> b -> c)
    -> Parser GraphvizState a
    -> Parser GraphvizState b
    -> Parser GraphvizState c
    forall (f :: * -> *) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 ArrowFill -> ArrowSide -> ArrowModifier
    ArrMod Parser GraphvizState ArrowFill
    forall a. ParseDot a => Parse a
    parseUnqt Parser GraphvizState ArrowSide
    forall a. ParseDot a => Parse a
    parseUnqt

    data ArrowFill = OpenArrow
                   | FilledArrow
                   deriving (ArrowFill -> ArrowFill -> Bool
    (ArrowFill -> ArrowFill -> Bool)
    -> (ArrowFill -> ArrowFill -> Bool) -> Eq ArrowFill
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArrowFill -> ArrowFill -> Bool
    == :: ArrowFill -> ArrowFill -> Bool
    $c/= :: ArrowFill -> ArrowFill -> Bool
    /= :: ArrowFill -> ArrowFill -> Bool
    Eq, Eq ArrowFill
    Eq ArrowFill =>
    (ArrowFill -> ArrowFill -> Ordering)
    -> (ArrowFill -> ArrowFill -> Bool)
    -> (ArrowFill -> ArrowFill -> Bool)
    -> (ArrowFill -> ArrowFill -> Bool)
    -> (ArrowFill -> ArrowFill -> Bool)
    -> (ArrowFill -> ArrowFill -> ArrowFill)
    -> (ArrowFill -> ArrowFill -> ArrowFill)
    -> Ord ArrowFill
    ArrowFill -> ArrowFill -> Bool
    ArrowFill -> ArrowFill -> Ordering
    ArrowFill -> ArrowFill -> ArrowFill
    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
    $ccompare :: ArrowFill -> ArrowFill -> Ordering
    compare :: ArrowFill -> ArrowFill -> Ordering
    $c< :: ArrowFill -> ArrowFill -> Bool
    < :: ArrowFill -> ArrowFill -> Bool
    $c<= :: ArrowFill -> ArrowFill -> Bool
    <= :: ArrowFill -> ArrowFill -> Bool
    $c> :: ArrowFill -> ArrowFill -> Bool
    > :: ArrowFill -> ArrowFill -> Bool
    $c>= :: ArrowFill -> ArrowFill -> Bool
    >= :: ArrowFill -> ArrowFill -> Bool
    $cmax :: ArrowFill -> ArrowFill -> ArrowFill
    max :: ArrowFill -> ArrowFill -> ArrowFill
    $cmin :: ArrowFill -> ArrowFill -> ArrowFill
    min :: ArrowFill -> ArrowFill -> ArrowFill
    Ord, ArrowFill
    ArrowFill -> ArrowFill -> Bounded ArrowFill
    forall a. a -> a -> Bounded a
    $cminBound :: ArrowFill
    minBound :: ArrowFill
    $cmaxBound :: ArrowFill
    maxBound :: ArrowFill
    Bounded, Int -> ArrowFill
    ArrowFill -> Int
    ArrowFill -> [ArrowFill]
    ArrowFill -> ArrowFill
    ArrowFill -> ArrowFill -> [ArrowFill]
    ArrowFill -> ArrowFill -> ArrowFill -> [ArrowFill]
    (ArrowFill -> ArrowFill)
    -> (ArrowFill -> ArrowFill)
    -> (Int -> ArrowFill)
    -> (ArrowFill -> Int)
    -> (ArrowFill -> [ArrowFill])
    -> (ArrowFill -> ArrowFill -> [ArrowFill])
    -> (ArrowFill -> ArrowFill -> [ArrowFill])
    -> (ArrowFill -> ArrowFill -> ArrowFill -> [ArrowFill])
    -> Enum ArrowFill
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: ArrowFill -> ArrowFill
    succ :: ArrowFill -> ArrowFill
    $cpred :: ArrowFill -> ArrowFill
    pred :: ArrowFill -> ArrowFill
    $ctoEnum :: Int -> ArrowFill
    toEnum :: Int -> ArrowFill
    $cfromEnum :: ArrowFill -> Int
    fromEnum :: ArrowFill -> Int
    $cenumFrom :: ArrowFill -> [ArrowFill]
    enumFrom :: ArrowFill -> [ArrowFill]
    $cenumFromThen :: ArrowFill -> ArrowFill -> [ArrowFill]
    enumFromThen :: ArrowFill -> ArrowFill -> [ArrowFill]
    $cenumFromTo :: ArrowFill -> ArrowFill -> [ArrowFill]
    enumFromTo :: ArrowFill -> ArrowFill -> [ArrowFill]
    $cenumFromThenTo :: ArrowFill -> ArrowFill -> ArrowFill -> [ArrowFill]
    enumFromThenTo :: ArrowFill -> ArrowFill -> ArrowFill -> [ArrowFill]
    Enum, Int -> ArrowFill -> ShowS
    [ArrowFill] -> ShowS
    ArrowFill -> String
    (Int -> ArrowFill -> ShowS)
    -> (ArrowFill -> String)
    -> ([ArrowFill] -> ShowS)
    -> Show ArrowFill
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArrowFill -> ShowS
    showsPrec :: Int -> ArrowFill -> ShowS
    $cshow :: ArrowFill -> String
    show :: ArrowFill -> String
    $cshowList :: [ArrowFill] -> ShowS
    showList :: [ArrowFill] -> ShowS
    Show, ReadPrec [ArrowFill]
    ReadPrec ArrowFill
    Int -> ReadS ArrowFill
    ReadS [ArrowFill]
    (Int -> ReadS ArrowFill)
    -> ReadS [ArrowFill]
    -> ReadPrec ArrowFill
    -> ReadPrec [ArrowFill]
    -> Read ArrowFill
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ArrowFill
    readsPrec :: Int -> ReadS ArrowFill
    $creadList :: ReadS [ArrowFill]
    readList :: ReadS [ArrowFill]
    $creadPrec :: ReadPrec ArrowFill
    readPrec :: ReadPrec ArrowFill
    $creadListPrec :: ReadPrec [ArrowFill]
    readListPrec :: ReadPrec [ArrowFill]
    Read)

    instance PrintDot ArrowFill where
      unqtDot :: ArrowFill -> DotCode
    unqtDot ArrowFill
    OpenArrow   = Char -> DotCode
    forall (m :: * -> *). Applicative m => Char -> m Doc
    char Char
    'o'
      unqtDot ArrowFill
    FilledArrow = DotCode
    forall (m :: * -> *). Applicative m => m Doc
    empty

    instance ParseDot ArrowFill where
      parseUnqt :: Parser GraphvizState ArrowFill
    parseUnqt = ArrowFill -> ArrowFill -> Bool -> ArrowFill
    forall a. a -> a -> Bool -> a
    bool ArrowFill
    FilledArrow ArrowFill
    OpenArrow (Bool -> ArrowFill)
    -> (Maybe Char -> Bool) -> Maybe Char -> ArrowFill
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Maybe Char -> Bool
    forall a. Maybe a -> Bool
    isJust (Maybe Char -> ArrowFill)
    -> Parser GraphvizState (Maybe Char)
    -> Parser GraphvizState ArrowFill
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Parser GraphvizState Char -> Parser GraphvizState (Maybe Char)
    forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
    optional (Char -> Parser GraphvizState Char
    character Char
    'o')

      -- Not used individually
      parse :: Parser GraphvizState ArrowFill
    parse = Parser GraphvizState ArrowFill
    forall a. ParseDot a => Parse a
    parseUnqt

    -- | Represents which side (when looking towards the node the arrow is
    --   pointing to) is drawn.
    data ArrowSide = LeftSide
                   | RightSide
                   | BothSides
                   deriving (ArrowSide -> ArrowSide -> Bool
    (ArrowSide -> ArrowSide -> Bool)
    -> (ArrowSide -> ArrowSide -> Bool) -> Eq ArrowSide
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArrowSide -> ArrowSide -> Bool
    == :: ArrowSide -> ArrowSide -> Bool
    $c/= :: ArrowSide -> ArrowSide -> Bool
    /= :: ArrowSide -> ArrowSide -> Bool
    Eq, Eq ArrowSide
    Eq ArrowSide =>
    (ArrowSide -> ArrowSide -> Ordering)
    -> (ArrowSide -> ArrowSide -> Bool)
    -> (ArrowSide -> ArrowSide -> Bool)
    -> (ArrowSide -> ArrowSide -> Bool)
    -> (ArrowSide -> ArrowSide -> Bool)
    -> (ArrowSide -> ArrowSide -> ArrowSide)
    -> (ArrowSide -> ArrowSide -> ArrowSide)
    -> Ord ArrowSide
    ArrowSide -> ArrowSide -> Bool
    ArrowSide -> ArrowSide -> Ordering
    ArrowSide -> ArrowSide -> ArrowSide
    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
    $ccompare :: ArrowSide -> ArrowSide -> Ordering
    compare :: ArrowSide -> ArrowSide -> Ordering
    $c< :: ArrowSide -> ArrowSide -> Bool
    < :: ArrowSide -> ArrowSide -> Bool
    $c<= :: ArrowSide -> ArrowSide -> Bool
    <= :: ArrowSide -> ArrowSide -> Bool
    $c> :: ArrowSide -> ArrowSide -> Bool
    > :: ArrowSide -> ArrowSide -> Bool
    $c>= :: ArrowSide -> ArrowSide -> Bool
    >= :: ArrowSide -> ArrowSide -> Bool
    $cmax :: ArrowSide -> ArrowSide -> ArrowSide
    max :: ArrowSide -> ArrowSide -> ArrowSide
    $cmin :: ArrowSide -> ArrowSide -> ArrowSide
    min :: ArrowSide -> ArrowSide -> ArrowSide
    Ord, ArrowSide
    ArrowSide -> ArrowSide -> Bounded ArrowSide
    forall a. a -> a -> Bounded a
    $cminBound :: ArrowSide
    minBound :: ArrowSide
    $cmaxBound :: ArrowSide
    maxBound :: ArrowSide
    Bounded, Int -> ArrowSide
    ArrowSide -> Int
    ArrowSide -> [ArrowSide]
    ArrowSide -> ArrowSide
    ArrowSide -> ArrowSide -> [ArrowSide]
    ArrowSide -> ArrowSide -> ArrowSide -> [ArrowSide]
    (ArrowSide -> ArrowSide)
    -> (ArrowSide -> ArrowSide)
    -> (Int -> ArrowSide)
    -> (ArrowSide -> Int)
    -> (ArrowSide -> [ArrowSide])
    -> (ArrowSide -> ArrowSide -> [ArrowSide])
    -> (ArrowSide -> ArrowSide -> [ArrowSide])
    -> (ArrowSide -> ArrowSide -> ArrowSide -> [ArrowSide])
    -> Enum ArrowSide
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: ArrowSide -> ArrowSide
    succ :: ArrowSide -> ArrowSide
    $cpred :: ArrowSide -> ArrowSide
    pred :: ArrowSide -> ArrowSide
    $ctoEnum :: Int -> ArrowSide
    toEnum :: Int -> ArrowSide
    $cfromEnum :: ArrowSide -> Int
    fromEnum :: ArrowSide -> Int
    $cenumFrom :: ArrowSide -> [ArrowSide]
    enumFrom :: ArrowSide -> [ArrowSide]
    $cenumFromThen :: ArrowSide -> ArrowSide -> [ArrowSide]
    enumFromThen :: ArrowSide -> ArrowSide -> [ArrowSide]
    $cenumFromTo :: ArrowSide -> ArrowSide -> [ArrowSide]
    enumFromTo :: ArrowSide -> ArrowSide -> [ArrowSide]
    $cenumFromThenTo :: ArrowSide -> ArrowSide -> ArrowSide -> [ArrowSide]
    enumFromThenTo :: ArrowSide -> ArrowSide -> ArrowSide -> [ArrowSide]
    Enum, Int -> ArrowSide -> ShowS
    [ArrowSide] -> ShowS
    ArrowSide -> String
    (Int -> ArrowSide -> ShowS)
    -> (ArrowSide -> String)
    -> ([ArrowSide] -> ShowS)
    -> Show ArrowSide
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArrowSide -> ShowS
    showsPrec :: Int -> ArrowSide -> ShowS
    $cshow :: ArrowSide -> String
    show :: ArrowSide -> String
    $cshowList :: [ArrowSide] -> ShowS
    showList :: [ArrowSide] -> ShowS
    Show, ReadPrec [ArrowSide]
    ReadPrec ArrowSide
    Int -> ReadS ArrowSide
    ReadS [ArrowSide]
    (Int -> ReadS ArrowSide)
    -> ReadS [ArrowSide]
    -> ReadPrec ArrowSide
    -> ReadPrec [ArrowSide]
    -> Read ArrowSide
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ArrowSide
    readsPrec :: Int -> ReadS ArrowSide
    $creadList :: ReadS [ArrowSide]
    readList :: ReadS [ArrowSide]
    $creadPrec :: ReadPrec ArrowSide
    readPrec :: ReadPrec ArrowSide
    $creadListPrec :: ReadPrec [ArrowSide]
    readListPrec :: ReadPrec [ArrowSide]
    Read)

    instance PrintDot ArrowSide where
      unqtDot :: ArrowSide -> DotCode
    unqtDot ArrowSide
    LeftSide  = Char -> DotCode
    forall (m :: * -> *). Applicative m => Char -> m Doc
    char Char
    'l'
      unqtDot ArrowSide
    RightSide = Char -> DotCode
    forall (m :: * -> *). Applicative m => Char -> m Doc
    char Char
    'r'
      unqtDot ArrowSide
    BothSides = DotCode
    forall (m :: * -> *). Applicative m => m Doc
    empty

    instance ParseDot ArrowSide where
      parseUnqt :: Parser GraphvizState ArrowSide
    parseUnqt = Maybe Char -> ArrowSide
    getSideType (Maybe Char -> ArrowSide)
    -> Parser GraphvizState (Maybe Char)
    -> Parser GraphvizState ArrowSide
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Parser GraphvizState Char -> Parser GraphvizState (Maybe Char)
    forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
    optional ([Parser GraphvizState Char] -> Parser GraphvizState Char
    forall (p :: * -> *) a. PolyParse p => [p a] -> p a
    oneOf ([Parser GraphvizState Char] -> Parser GraphvizState Char)
    -> [Parser GraphvizState Char] -> Parser GraphvizState Char
    forall a b. (a -> b) -> a -> b
    $ (Char -> Parser GraphvizState Char)
    -> String -> [Parser GraphvizState Char]
    forall a b. (a -> b) -> [a] -> [b]
    map Char -> Parser GraphvizState Char
    character [Char
    'l', Char
    'r'])
        where
          getSideType :: Maybe Char -> ArrowSide
    getSideType = ArrowSide -> (Char -> ArrowSide) -> Maybe Char -> ArrowSide
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe ArrowSide
    BothSides
                              (ArrowSide -> ArrowSide -> Bool -> ArrowSide
    forall a. a -> a -> Bool -> a
    bool ArrowSide
    RightSide ArrowSide
    LeftSide (Bool -> ArrowSide) -> (Char -> Bool) -> Char -> ArrowSide
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    (==) Char
    'l')

      -- Not used individually
      parse :: Parser GraphvizState ArrowSide
    parse = Parser GraphvizState ArrowSide
    forall a. ParseDot a => Parse a
    parseUnqt