Skip to content

Commit 57d084a

Browse files
committed
Let benchmarks build on older GHC
1 parent ba3e4b2 commit 57d084a

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

fgl.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ benchmark fgl-benchmark {
117117

118118
main-is: benchmark.hs
119119

120+
other-modules: Data.Graph.Inductive.Proxy
120121

121122
build-depends: fgl
122123
, base

test/benchmark.hs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@
3636
4.532ns per iteration / 220663.09 per second.
3737
-}
3838

39-
{-# LANGUAGE CPP, ScopedTypeVariables #-}
40-
#if __GLASGOW_HASKELL__ >= 708
39+
{-# LANGUAGE ScopedTypeVariables #-}
4140

4241
import Control.DeepSeq
43-
import Data.Foldable (foldl')
4442
import Data.Graph.Inductive.Graph
4543
import qualified Data.Graph.Inductive.PatriciaTree as Patricia
44+
import Data.Graph.Inductive.Proxy
4645
import qualified Data.Graph.Inductive.Tree as AVL
47-
import Data.Proxy
4846
import Microbench
4947

5048
main :: IO ()
@@ -67,17 +65,17 @@ main = do microbench "insNode into AVL tree" insNodeAVL
6765
microbench "emap on AVL tree" emapAVL
6866
microbench "emap on PATRICIA tree" emapPatricia
6967

70-
7168
insNodeAVL :: Int -> AVL.UGr
7269
insNodeAVL = insNodes' empty
7370

7471
buildFullPatricia :: Int -> Int -> ()
75-
buildFullPatricia sz i = buildFull (Proxy :: Proxy Patricia.Gr) sz i
72+
buildFullPatricia sz i = buildFull (Proxy :: PatriciaTreeP) sz i
7673

7774
insNodePatricia :: Int -> Patricia.UGr
7875
insNodePatricia = insNodes' empty
7976

80-
buildFull :: forall gr proxy . (DynGraph gr, NFData (gr Int ())) => proxy gr -> Int -> Int -> ()
77+
buildFull :: forall gr . (DynGraph gr, NFData (gr Int ()))
78+
=> GraphProxy gr -> Int -> Int -> ()
8179
buildFull _ sz ntimes = rnf [buildFull' i (empty :: gr Int ()) 0 sz | i <- [0..ntimes-1]]
8280

8381
buildFull' :: DynGraph gr => a -> gr a () -> Int -> Int -> gr a ()
@@ -164,8 +162,3 @@ emapPatricia n
164162
f _ = n
165163
in
166164
g'
167-
168-
#else
169-
main :: IO ()
170-
main = putStrLn "Benchmarks are only supported for GHC 7.8 and above."
171-
#endif

0 commit comments

Comments
 (0)