aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs2
-rw-r--r--src/Test/VeriFuzz/Graph/Random.hs15
2 files changed, 11 insertions, 6 deletions
diff --git a/app/Main.hs b/app/Main.hs
index d41d46b..e3efc80 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -14,6 +14,6 @@ instance Labellable Gate where
main :: IO ()
--main = sample (arbitrary :: Gen (Circuit Input))
main = do
- gr <- randomDAG 100 :: IO (Gr Gate ())
+ gr <- genRandomDAG 100 :: IO (Gr Gate ())
-- _ <- runGraphviz (graphToDot quickParams $ emap (const "") gr) Png "output.png"
T.putStrLn $ generate gr
diff --git a/src/Test/VeriFuzz/Graph/Random.hs b/src/Test/VeriFuzz/Graph/Random.hs
index 9aa849b..348c5f6 100644
--- a/src/Test/VeriFuzz/Graph/Random.hs
+++ b/src/Test/VeriFuzz/Graph/Random.hs
@@ -14,12 +14,17 @@ arbitraryEdge n = do
with = suchThat . resize n $ arbitrary
randomDAG :: (Arbitrary l, Arbitrary e, Graph gr)
- => Int -- ^ The number of nodes
- -> IO (gr l e) -- ^ The generated graph. It uses Arbitrary to
- -- generate random instances of each node
+ => Int -- ^ The number of nodes
+ -> Gen (gr l e) -- ^ The generated graph. It uses Arbitrary to
+ -- generate random instances of each node
randomDAG n = do
- list <- generate . infiniteListOf $ arbitrary
- l <- generate . infiniteListOf $ arbitraryEdge n
+ list <- infiniteListOf $ arbitrary
+ l <- infiniteListOf $ arbitraryEdge n
return . mkGraph (nodes list) $ take (10*n) l
where
nodes l = zip [0..n] $ take n l
+
+genRandomDAG :: (Arbitrary l, Arbitrary e, Graph gr)
+ => Int
+ -> IO (gr l e)
+genRandomDAG = generate . randomDAG