File: Graph.hs

package info (click to toggle)
haskell-graphviz 2999.17.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,488 kB
  • sloc: haskell: 12,152; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 983 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE FlexibleInstances #-}

{- |
   Module      : Data.GraphViz.Testing.Instances.Graph
   Description : Graph dot graph instances for Arbitrary.
   Copyright   : (c) Ivan Lazar Miljenovic
   License     : 3-Clause BSD-style
   Maintainer  : Ivan.Miljenovic@gmail.com
 -}
module Data.GraphViz.Testing.Instances.Graph where

import Data.GraphViz.Testing.Instances.Canonical()

import Data.GraphViz.Types.Graph
import Data.GraphViz.Types(fromCanonical)

import Test.QuickCheck

import Control.Monad(liftM)

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

-- | Can't directly create one of these as it might not match the
--   internal format directly; as such, have to use the inefficient
--   'fromCanonical' route.
instance (Arbitrary n, Ord n) => Arbitrary (DotGraph n) where
  arbitrary = liftM fromCanonical arbitrary

  shrink = map fromCanonical . shrink . toCanonical