packages feed

graphviz 2999.17.0.2 → 2999.18.0.0

raw patch · 19 files changed

+129/−167 lines, 19 filesdep +fgl-arbitrarydep ~QuickCheckdep ~basedep ~containersPVP ok

version bump matches the API change (PVP)

Dependencies added: fgl-arbitrary

Dependency ranges changed: QuickCheck, base, containers, criterion, directory, filepath, process, text

API changes (from Hackage documentation)

- Data.GraphViz.Exception: CmdNotFound :: String -> GraphvizException
+ Data.GraphViz.Attributes.Complete: NoTranslate :: Bool -> Attribute
+ Data.GraphViz.Attributes.HTML: Overline :: Format

Files

Changelog.md view
@@ -7,6 +7,34 @@ The following is information about what major changes have gone into each release. +Changes in 2999.18.0.0+----------------------++* Now builds on GHC 7.10.*.++* Attribute changes:++    - Added the `NoTranslate` attribute.++    - Add support for overlines in HTML labels.++    Both of these are available as of Graphviz 2.38.0, but were+    somehow overlooked in previous releases of this library.++* Uses new `fgl-arbitrary` library for testing rather than custom+  instances for FGL graphs.++* Migrated to git; central repository now on+  [GitHub](https://github.com/ivan-m/graphviz).++Changes in 2999.17.0.2+----------------------++* Augmentation tests are no longer run by default.  This avoids+  problems where Graphviz is not installed/configured properly.++* Use `.gv` for temporary files instead of `.dot`.+ Changes in 2999.17.0.1 ---------------------- 
Data/GraphViz.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, OverloadedStrings #-}+{-# LANGUAGE CPP, FlexibleContexts, MultiParamTypeClasses, OverloadedStrings #-}  {- |    Module      : Data.GraphViz@@ -78,7 +78,6 @@  import           Control.Arrow              (first, (&&&)) import           Control.Concurrent         (forkIO)-import           Data.Functor               ((<$>)) import           Data.Graph.Inductive.Graph import qualified Data.Map                   as Map import           Data.Maybe                 (fromJust, mapMaybe)@@ -86,6 +85,10 @@ import           Data.Text.Lazy             (Text) import qualified Data.Text.Lazy             as T import           System.IO.Unsafe           (unsafePerformIO)++#if !(MIN_VERSION_base (4,8,0))+import Data.Functor ((<$>))+#endif  -- ----------------------------------------------------------------------------- 
Data/GraphViz/Algorithms.hs view
@@ -382,7 +382,7 @@      esMS = do edgeGraph tes               ns <- getsMap Map.keys-              mapM_ (traverse zeroTag) ns+              mapM_ (traverseTag zeroTag) ns      esM = fst $ execState esMS (Map.empty, Set.empty) @@ -442,13 +442,12 @@                                }  -- Perform a DFS to determine whether or not to keep each edge.-traverse     :: (Ord n) => Tag -> n -> TagState n ()-traverse t n = do setMark True-                  checkIncoming-                  outEs <- getsMap (maybe [] outgoing . Map.lookup n)-                  mapM_ maybeRecurse outEs-                  setMark False-+traverseTag     :: (Ord n) => Tag -> n -> TagState n ()+traverseTag t n = do setMark True+                     checkIncoming+                     outEs <- getsMap (maybe [] outgoing . Map.lookup n)+                     mapM_ maybeRecurse outEs+                     setMark False   where     setMark mrk = modifyMap (Map.adjust (\tv -> tv { marked = mrk }) n) @@ -471,4 +470,4 @@                              delSet <- getSet                              let n' = toNode e                              unless (isMarked m n' || t' `Set.member` delSet)-                               $ traverse t' n'+                               $ traverseTag t' n'
Data/GraphViz/Attributes/Complete.hs view
@@ -346,6 +346,7 @@   | 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@@ -514,6 +515,7 @@   unqtDot (NodeSep v)            = printField "nodesep" v   unqtDot (NoJustify v)          = printField "nojustify" v   unqtDot (Normalize v)          = printField "normalize" v+  unqtDot (NoTranslate v)        = printField "notranslate" v   unqtDot (Nslimit v)            = printField "nslimit" v   unqtDot (Nslimit1 v)           = printField "nslimit1" v   unqtDot (Ordering v)           = printField "ordering" v@@ -678,6 +680,7 @@                                   , parseField NodeSep "nodesep"                                   , parseFieldBool NoJustify "nojustify"                                   , parseFieldDef Normalize IsNormalized "normalize"+                                  , parseFieldBool NoTranslate "notranslate"                                   , parseField Nslimit "nslimit"                                   , parseField Nslimit1 "nslimit1"                                   , parseField Ordering "ordering"@@ -809,6 +812,7 @@ usedByGraphs NodeSep{}            = True usedByGraphs NoJustify{}          = True usedByGraphs Normalize{}          = True+usedByGraphs NoTranslate{}        = True usedByGraphs Nslimit{}            = True usedByGraphs Nslimit1{}           = True usedByGraphs Ordering{}           = True@@ -1099,6 +1103,7 @@ sameAttribute NodeSep{}               NodeSep{}               = True sameAttribute NoJustify{}             NoJustify{}             = True sameAttribute Normalize{}             Normalize{}             = True+sameAttribute NoTranslate{}           NoTranslate{}           = True sameAttribute Nslimit{}               Nslimit{}               = True sameAttribute Nslimit1{}              Nslimit1{}              = True sameAttribute Ordering{}              Ordering{}              = True@@ -1248,6 +1253,7 @@ defaultAttributeValue NodeSep{}            = Just $ NodeSep 0.25 defaultAttributeValue NoJustify{}          = Just $ NoJustify False defaultAttributeValue Normalize{}          = Just $ Normalize NotNormalized+defaultAttributeValue NoTranslate{}        = Just $ NoTranslate False defaultAttributeValue Orientation{}        = Just $ Orientation 0.0 defaultAttributeValue OutputOrder{}        = Just $ OutputOrder BreadthFirst defaultAttributeValue Overlap{}            = Just $ Overlap KeepOverlaps@@ -1399,6 +1405,7 @@                , "nodesep"                , "nojustify"                , "normalize"+               , "notranslate"                , "nslimit"                , "nslimit1"                , "ordering"
Data/GraphViz/Attributes/HTML.hs view
@@ -156,6 +156,7 @@ data Format = Italics               | Bold               | Underline+              | Overline -- ^ Requires Graphviz >= 2.38.0.               | Subscript               | Superscript               deriving (Eq, Ord, Bounded, Enum, Show, Read)@@ -164,6 +165,7 @@   unqtDot Italics     = text "I"   unqtDot Bold        = text "B"   unqtDot Underline   = text "U"+  unqtDot Overline    = text "O"   unqtDot Subscript   = text "SUB"   unqtDot Superscript = text "SUP" @@ -171,6 +173,7 @@   parseUnqt = stringValue [ ("I", Italics)                           , ("B", Bold)                           , ("U", Underline)+                          , ("O", Overline)                           , ("SUB", Subscript)                           , ("SUP", Superscript)                           ]
Data/GraphViz/Commands.hs view
@@ -166,7 +166,7 @@   outputCall Bmp       = "bmp"   outputCall Canon     = "canon"   outputCall DotOutput = "dot"-  outputCall (XDot mv) = "xdot" ++ maybe "" (showVersion . (\v -> v {versionTags = []})) mv+  outputCall (XDot mv) = "xdot" ++ maybe "" showVersion mv   outputCall Eps       = "eps"   outputCall Fig       = "fig"   outputCall Gd        = "gd"
Data/GraphViz/Commands/IO.hs view
@@ -38,7 +38,7 @@ import           Control.Concurrent        (MVar, forkIO, newEmptyMVar, putMVar,                                             takeMVar) import           Control.Exception         (IOException, evaluate, finally)-import           Control.Monad             (liftM, unless)+import           Control.Monad             (liftM) import           Control.Monad.Trans.State import qualified Data.ByteString           as SB import           Data.ByteString.Lazy      (ByteString)@@ -46,11 +46,8 @@ import           Data.Text.Encoding.Error  (UnicodeException) import           Data.Text.Lazy            (Text) import qualified Data.Text.Lazy.Encoding   as T-import           System.Directory          (canonicalizePath, doesFileExist,-                                            executable, findExecutable,-                                            getHomeDirectory, getPermissions) import           System.Exit               (ExitCode (ExitSuccess))-import           System.FilePath           (joinPath, splitDirectories, (<.>))+import           System.FilePath           ((<.>)) import           System.IO                 (Handle,                                             IOMode (ReadMode, WriteMode),                                             hClose, hGetContents, hPutChar,@@ -155,11 +152,8 @@               -> (Handle -> IO a) -- ^ Obtaining the output; should be strict.               -> dg n               -> IO a-runCommand cmd args hf dg = do-  isEx <- isExecutable cmd-  unless isEx (throw $ CmdNotFound cmd)--  mapException notRunnable $+runCommand cmd args hf dg+  = mapException notRunnable $     withSystemTempFile ("graphviz" <.> "gv") $ \dotFile dotHandle -> do       finally (hPutCompactDot dotHandle dg) (hClose dotHandle)       bracket@@ -220,41 +214,3 @@ -- | Store the result of the 'Handle' consumption into the 'MVar'. signalWhenDone        :: (Handle -> IO a) -> Handle -> MVar a -> IO () signalWhenDone f h mv = f h >>= putMVar mv >> return ()--canonicalizeExecutable :: String -> IO (Maybe FilePath)-canonicalizeExecutable cmd = liftMaybePlus (findExecutable cmd) checkPath-  where-    -- Check to see if it's an explicitly listed command-    checkPath = handle noSuchFile $-                  do fp <- canonicalizePath' cmd-                     prm <- getPermissions fp-                     if executable prm-                        then return (Just fp)-                        else return Nothing--    noSuchFile :: IOException -> IO (Maybe FilePath)-    noSuchFile = const (return Nothing)--isExecutable :: FilePath -> IO Bool-isExecutable cmd = findExecutable cmd >>= maybe checkPath (const (return True))-  where-    -- Check to see if it's an explicitly listed command-    checkPath = handle noSuchFile $-                  do fp <- canonicalizePath' cmd-                     ex <- doesFileExist fp-                     if ex-                        then executable `fmap` getPermissions fp-                        else return False--    noSuchFile :: IOException -> IO Bool-    noSuchFile = const (return False)--liftMaybePlus :: IO (Maybe a) -> IO (Maybe a) -> IO (Maybe a)-liftMaybePlus mm1 mm2 = mm1 >>= maybe mm2 (return . Just)--canonicalizePath' :: FilePath -> IO FilePath-canonicalizePath' fp = do fp' <- case splitDirectories fp of-                                   "~":ds -> do hd <- getHomeDirectory-                                                return (joinPath (hd:ds))-                                   _      -> return fp-                          canonicalizePath fp'
Data/GraphViz/Exception.hs view
@@ -35,7 +35,6 @@                        | NotUTF8Dot String                        | GVProgramExc String                        | NotCustomAttr String-                       | CmdNotFound String                        deriving (Eq, Ord, Typeable)  instance Show GraphvizException where@@ -43,6 +42,5 @@   showsPrec _ (NotUTF8Dot str)    = showString $ "Invalid UTF-8 Dot code: " ++ str   showsPrec _ (GVProgramExc str)  = showString $ "Error running utility program: " ++ str   showsPrec _ (NotCustomAttr str) = showString $ "Not a custom Attribute: " ++ str-  showsPrec _ (CmdNotFound str)   = showString $ "Command not found: " ++ str  instance Exception GraphvizException
Data/GraphViz/Internal/Util.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, PatternGuards #-}+{-# LANGUAGE CPP, OverloadedStrings, PatternGuards #-} {-# OPTIONS_HADDOCK hide #-}  {- |@@ -23,8 +23,13 @@ import           Data.Text.Lazy      (Text) import qualified Data.Text.Lazy      as T import qualified Data.Text.Lazy.Read as T-import           Data.Version        (Version (..)) +#if MIN_VERSION_base(4,8,0)+import Data.Version (Version, makeVersion)+#else+import Data.Version (Version (..))+#endif+ -- -----------------------------------------------------------------------------  isIDString :: Text -> Bool@@ -137,8 +142,12 @@                         , "strict"                         ] -createVersion    :: [Int] -> Version+createVersion :: [Int] -> Version+#if MIN_VERSION_base(4,8,0)+createVersion = makeVersion+#else createVersion bs = Version { versionBranch = bs, versionTags = []}+#endif  -- ----------------------------------------------------------------------------- 
Data/GraphViz/PreProcessing.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {- |    Module      : Data.GraphViz.PreProcessing    Description : Pre-process imported Dot code.@@ -9,7 +11,7 @@    parseable by this library.  This module defines the 'preProcess'    function to remove these components, which include: -     * Comments (both @\/* ... *\/@ style and @\/\/ ... @ style);+     * Comments (both @\/\* ... *\/@ style and @\/\/ ... @ style);       * Pre-processor lines (lines starting with a @#@); @@ -21,14 +23,17 @@ -} module Data.GraphViz.PreProcessing(preProcess) where +import Data.GraphViz.Exception (GraphvizException (NotDotCode), throw) import Data.GraphViz.Parsing-import Data.GraphViz.Exception(GraphvizException(NotDotCode), throw) -import qualified Data.Text.Lazy as T-import Data.Text.Lazy(Text)+import           Data.Text.Lazy         (Text)+import qualified Data.Text.Lazy         as T+import           Data.Text.Lazy.Builder (Builder) import qualified Data.Text.Lazy.Builder as B-import Data.Text.Lazy.Builder(Builder)-import Data.Monoid(Monoid(..), mconcat)++#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (Monoid (..), mconcat)+#endif  -- ----------------------------------------------------------------------------- -- Filtering out unwanted Dot items such as comments
Data/GraphViz/Types/Graph.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE CPP, FlexibleInstances, MultiParamTypeClasses #-}  {- |    Module      : Data.GraphViz.Types.Graph@@ -109,7 +109,7 @@ import           Data.GraphViz.Types.Internal.Common (partitionGlobal) import qualified Data.GraphViz.Types.State           as St -import           Control.Applicative             (liftA2, (<$>), (<*>))+import           Control.Applicative             (liftA2) import           Control.Arrow                   ((***)) import qualified Data.Foldable                   as F import           Data.List                       (delete, foldl', unfoldr)@@ -121,6 +121,10 @@ import           Text.ParserCombinators.ReadPrec (prec) import           Text.Read                       (Lexeme (Ident), lexP, parens,                                                   readPrec)++#if !(MIN_VERSION_base (4,8,0))+import Control.Applicative ((<$>), (<*>))+#endif  -- ----------------------------------------------------------------------------- 
Data/GraphViz/Types/Monadic.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE CPP, FlexibleInstances, MultiParamTypeClasses #-}  {- |    Module      : Data.GraphViz.Types.Monadic@@ -78,10 +78,13 @@ import Data.GraphViz.Attributes        (Attributes) import Data.GraphViz.Types.Generalised -import           Control.Applicative (Applicative (..))-import           Data.DList          (DList)-import qualified Data.DList          as DL-import qualified Data.Sequence       as Seq+import           Data.DList    (DList)+import qualified Data.DList    as DL+import qualified Data.Sequence as Seq++#if !(MIN_VERSION_base (4,8,0))+import Control.Applicative (Applicative (..))+#endif  -- ----------------------------------------------------------------------------- -- The Dot monad.
FAQ.md view
@@ -200,16 +200,16 @@  Also on its [HackageDB] page. -### Is it safe to install and use _graphviz_ from its darcs repository? ###+### Is it safe to install and use _graphviz_ from its git repository? ###  No; unlike other projects I make no guarantees as to the stability of-the live version of _graphviz_.  Whilst the [darcs] [repository] is+the live version of _graphviz_.  Whilst the [git] [repository] is _usually_ stable, it's often in a state of flux and at times patches that break the repository are recorded (when it's simpler/cleaner to break one patch into several smaller patches). -[darcs]: http://darcs.net/-[repository]: http://hub.darcs.net/ivanm/graphviz+[git]: http://git-scm.com/+[repository]: https://github.com/ivan-m/graphviz/  ### How is _graphviz_ licensed? ### @@ -227,7 +227,7 @@ used.  [Matthew Sackman]: http://www.wellquite.org/-[email]: mailto:Ivan.Miljenovic+graphviz@gmail.com+[email]: mailto:Ivan.Miljenovic@gmail.com  ### Where can I find more information on _graphviz_? ### @@ -602,33 +602,21 @@  ### I've found a bug! ### -Oh-oh... please [email] me the specifics of what you were doing-(including the Dot file in question if it's a parsing problem) and-I'll get right on it.+Oh-oh... please file a report at the GitHub [repository] to tell me+the specifics of what you were doing (including the Dot file in+question if it's a parsing problem) and I'll get right on it.  ### I have a feature request. ### -Is it in the TODO?  If not, [email] me and I'll consider implementing-it (depending on time and how well I think it will fit in the overall-library).+Is it in the TODO?  If not, file an issue at the GitHub [repository]+and I'll consider implementing it (depending on time and how well I+think it will fit in the overall library).  ### I want to help out with developing _graphviz_. ###  Great!  Whether you have a specific feature in mind or want to help-clear the TODO list, please [email] me to check with what you're doing-(who knows, I could already be implementing that very feature).--Once we've discussed what you're going to do, first get yourself a-copy of the darcs repository:--~~~~~~~~~~~~~~~~~~~~ {.bash}-darcs get --lazy http://hub.darcs.net/ivanm/graphviz-~~~~~~~~~~~~~~~~~~~~--Once you've made your changes, make sure you build and run the-testsuite (and ensure it passes!).  Then record the patch[es] and-`darcs send` them.  I'll then review them and if I'm happy with them,-I'll apply them.+clear the TODO list, please create a pull-request on the GitHub+[repository].  ### What is the purpose of the AttributeGenerator.hs file? ### 
README.md view
@@ -4,6 +4,8 @@ The graphviz Library ==================== +[![Hackage](https://img.shields.io/hackage/v/graphviz.svg)](https://hackage.haskell.org/package/graphviz) [![Build Status](https://travis-ci.org/ivan-m/graphviz.svg)](https://travis-ci.org/ivan-m/graphviz)+ The _graphviz_ library provides bindings to the [Graphviz] graph visualisation suite of tools for the purely functional programming language [Haskell].  It can be downloaded from [HackageDB] or - if you
graphviz.cabal view
@@ -1,5 +1,5 @@ Name:               graphviz-Version:            2999.17.0.2+Version:            2999.18.0.0 Stability:          Beta Synopsis:           Bindings to Graphviz for graph visualisation. Description: {@@ -36,9 +36,10 @@ License-File:       LICENSE.md Copyright:          Matthew Sackman, Ivan Lazar Miljenovic Author:             Matthew Sackman, Ivan Lazar Miljenovic-Maintainer:         Ivan.Miljenovic+graphviz@gmail.com-Bug-Reports:        http://hub.darcs.net/ivanm/graphviz/issues+Maintainer:         Ivan.Miljenovic@gmail.com Build-Type:         Simple+Tested-With:        GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4,+                    GHC == 7.10.2, GHC == 7.11.* Cabal-Version:      >= 1.14 Extra-Source-Files: TODO.md                     Changelog.md@@ -47,8 +48,8 @@                     utils/AttributeGenerator.hs  Source-Repository head-    Type:         darcs-    Location:     http://hub.darcs.net/ivanm/graphviz+    Type:         git+    Location:     git://github.com/ivan-m/graphviz.git  Flag test-parsing      Description: Build a utility to test parsing of available Dot code.@@ -112,7 +113,7 @@         if impl(ghc >= 6.12.1)            Ghc-Options: -fno-warn-unused-do-bind -        Ghc-Prof-Options:  -prof -auto-all+        Ghc-Prof-Options:  -prof }  Test-Suite graphviz-testsuite {@@ -125,9 +126,10 @@                            graphviz,                            containers,                            fgl,+                           fgl-arbitrary == 0.2.0.0,                            filepath,                            text,-                           QuickCheck >= 2.3 && < 2.8+                           QuickCheck >= 2.3 && < 2.9          hs-Source-Dirs:    tests @@ -137,7 +139,6 @@         Other-Modules:       Data.GraphViz.Testing                              Data.GraphViz.Testing.Instances                              Data.GraphViz.Testing.Properties-                             Data.GraphViz.Testing.Instances.FGL                              Data.GraphViz.Testing.Instances.Helpers                              Data.GraphViz.Testing.Instances.Attributes                              Data.GraphViz.Testing.Instances.Common@@ -151,7 +152,7 @@         if impl(ghc >= 6.12.1)            Ghc-Options: -fno-warn-unused-do-bind -        GHC-Prof-Options: -auto-all -caf-all -rtsopts+        GHC-Prof-Options: -caf-all -rtsopts }  Benchmark graphviz-printparse {@@ -163,7 +164,7 @@                           deepseq,                           text,                           graphviz,-                          criterion >= 0.5 && < 0.9+                          criterion >= 0.5 && < 1.2          hs-Source-Dirs:   utils @@ -175,7 +176,7 @@         if impl(ghc >= 6.12.1)            Ghc-Options: -fno-warn-unused-do-bind -        GHC-Prof-Options: -auto-all -caf-all -rtsopts+        GHC-Prof-Options: -caf-all -rtsopts }  Executable graphviz-testparsing {@@ -199,5 +200,5 @@          Ghc-Options: -O -Wall -        GHC-Prof-Options: -auto-all -caf-all -rtsopts+        GHC-Prof-Options: -caf-all -rtsopts }
tests/Data/GraphViz/Testing/Instances.hs view
@@ -18,10 +18,9 @@  -} module Data.GraphViz.Testing.Instances() where -import Data.GraphViz.Testing.Instances.FGL()-import Data.GraphViz.Testing.Instances.Canonical()-import Data.GraphViz.Testing.Instances.Generalised()-import Data.GraphViz.Testing.Instances.Graph()+import Data.Graph.Inductive.Arbitrary              ()+import Data.GraphViz.Testing.Instances.Canonical   ()+import Data.GraphViz.Testing.Instances.Generalised ()+import Data.GraphViz.Testing.Instances.Graph       ()  -- ------------------------------------------------------------------------------
tests/Data/GraphViz/Testing/Instances/Attributes.hs view
@@ -154,6 +154,7 @@                     , liftM NodeSep arbitrary                     , liftM NoJustify arbitrary                     , liftM Normalize arbitrary+                    , liftM NoTranslate arbitrary                     , liftM Nslimit arbitrary                     , liftM Nslimit1 arbitrary                     , liftM Ordering arbitrary@@ -316,6 +317,7 @@   shrink (NodeSep v)            = map NodeSep             $ shrink v   shrink (NoJustify v)          = map NoJustify           $ shrink v   shrink (Normalize v)          = map Normalize           $ shrink v+  shrink (NoTranslate v)        = map NoTranslate         $ shrink v   shrink (Nslimit v)            = map Nslimit             $ shrink v   shrink (Nslimit1 v)           = map Nslimit1            $ shrink v   shrink (Ordering v)           = map Ordering            $ shrink v
− tests/Data/GraphViz/Testing/Instances/FGL.hs
@@ -1,47 +0,0 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE FlexibleInstances #-}--{- |-   Module      : Data.GraphViz.Testing.Instances.FGL-   Description : 'Arbitrary' instances for FGL graphs.-   Copyright   : (c) Ivan Lazar Miljenovic-   License     : 3-Clause BSD-style-   Maintainer  : Ivan.Miljenovic@gmail.com--   This module defines the 'Arbitrary' instances for FGL 'DynGraph'-   graphs.  Note that this instance cannot be in-   "Data.GraphViz.Testing.Instances", as this instance requires the-   FlexibleInstances extension, which makes some of the other-   'Arbitrary' instances fail to type-check.--}-module Data.GraphViz.Testing.Instances.FGL() where--import Test.QuickCheck--import Data.GraphViz.Internal.Util (uniq)--import Control.Monad              (liftM, liftM3)-import Data.Function              (on)-import Data.Graph.Inductive.Graph (Graph, delNode, mkGraph, nodes)-import Data.List                  (sortBy)---- -------------------------------------------------------------------------------- Arbitrary instance for FGL graphs.--instance (Graph g, Arbitrary n, Arbitrary e) => Arbitrary (g n e) where-  arbitrary = do ns <- suchThat genNs (not . null)-                 let nGen = elements ns-                 lns <- mapM makeLNode ns-                 les <- liftM (sortBy (compare `on` toE)) . listOf-                        $ makeLEdge nGen-                 return $ mkGraph lns les-    where-      genNs = liftM uniq arbitrary-      toE (f,t,_) = (f,t)-      makeLNode n = liftM ((,) n) arbitrary-      makeLEdge nGen = liftM3 (,,) nGen nGen arbitrary--  shrink gr = case nodes gr of-                   -- Need to have at least 2 nodes before we delete one!-                   ns@(_:_:_) -> map (`delNode` gr) ns-                   _          -> []
utils/AttributeGenerator.hs view
@@ -560,6 +560,7 @@   makeAttr "NodeSep" ["nodesep"] "G" (Dbl) Nothing (Just "0.25") (Just "@0.25@") (Just "@0.02@") Nothing,   makeAttr "NoJustify" ["nojustify"] "GCNE" (Bl) (Just "True") (Just "False") (Just "@'False'@") Nothing Nothing,   makeAttr "Normalize" ["normalize"] "G" (Cust "Normalized") (Just "IsNormalized") (Just "NotNormalized") (Just "@'NotNormalized'@") Nothing (Just "not 'Dot'"),+  makeAttr "NoTranslate" ["notranslate"] "G" (Bl) (Just "True") (Just "False") (Just "@'False'@") Nothing (Just "'Neato' only, requires Graphviz >= 2.38.0"),   makeAttr "Nslimit" ["nslimit"] "G" (Dbl) Nothing Nothing Nothing Nothing (Just "'Dot' only"),   makeAttr "Nslimit1" ["nslimit1"] "G" (Dbl) Nothing Nothing Nothing Nothing (Just "'Dot' only"),   makeAttr "Ordering" ["ordering"] "GN" (Cust "Order") Nothing Nothing (Just "none") Nothing (Just "'Dot' only"),@@ -751,6 +752,7 @@ | NodeSep         | nodesep         | G       | Dbl             |            | 0.25            | @0.25@               | @0.02@     |                      | | NoJustify       | nojustify       | GCNE    | Bl              | True       | False           | @'False'@            |            |                      | | Normalize       | normalize       | G       | Cust "Normalized" | IsNormalized | NotNormalized   | @'NotNormalized'@    |            | not 'Dot'            |+| NoTranslate     | notranslate     | G       | Bl              | True       | False           | @'False'@            |            | 'Neato' only, requires Graphviz >= 2.38.0 | | Nslimit         | nslimit         | G       | Dbl             |            |                 |                      |            | 'Dot' only           | | Nslimit1        | nslimit1        | G       | Dbl             |            |                 |                      |            | 'Dot' only           | | Ordering        | ordering        | GN      | Cust "Order"    |            |                 | none                 |            | 'Dot' only           |