File tree Expand file tree Collapse file tree 3 files changed +64
-1
lines changed Expand file tree Collapse file tree 3 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -882,7 +882,6 @@ foldl f z = \t -> -- Use lambda t to be inlinable with two arguments only.
882
882
| otherwise -> go (go z l) r
883
883
_ -> go z t
884
884
where
885
- STRICT_1_OF_2 (go)
886
885
go z' Nil = z'
887
886
go z' (Tip kx bm) = foldlBits kx f z' bm
888
887
go z' (Bin _ _ l r) = go (go z' l) r
Original file line number Diff line number Diff line change @@ -252,3 +252,21 @@ test-suite intmap-strictness-properties
252
252
253
253
ghc-options : -Wall
254
254
include-dirs : include
255
+
256
+ test-suite intset-strictness-properties
257
+ hs-source-dirs : tests, .
258
+ main-is : intset-strictness.hs
259
+ type : exitcode-stdio-1.0
260
+
261
+ build-depends :
262
+ array,
263
+ base >= 4.2 && < 5 ,
264
+ ChasingBottoms,
265
+ deepseq >= 1.2 && < 1.5 ,
266
+ QuickCheck >= 2.4.0.1 ,
267
+ ghc-prim,
268
+ test-framework >= 0.3.3 ,
269
+ test-framework-quickcheck2 >= 0.2.9
270
+
271
+ ghc-options : -Wall
272
+ include-dirs : include
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-}
2
+ {-# OPTIONS_GHC -fno-warn-orphans #-}
3
+
4
+ module Main (main ) where
5
+
6
+ import Prelude hiding (foldl )
7
+
8
+ import Test.ChasingBottoms.IsBottom
9
+ import Test.Framework (Test , defaultMain , testGroup )
10
+ import Test.Framework.Providers.QuickCheck2 (testProperty )
11
+
12
+ import Data.IntSet
13
+
14
+ ------------------------------------------------------------------------
15
+ -- * Properties
16
+
17
+ ------------------------------------------------------------------------
18
+ -- ** Lazy module
19
+
20
+ pFoldlAccLazy :: Int -> Bool
21
+ pFoldlAccLazy k =
22
+ isn'tBottom $ foldl (\ _ x -> x) (bottom :: Int ) (singleton k)
23
+
24
+ ------------------------------------------------------------------------
25
+ -- * Test list
26
+
27
+ tests :: [Test ]
28
+ tests =
29
+ [
30
+ -- Basic interface
31
+ testGroup " IntSet"
32
+ [ testProperty " foldl is lazy in accumulator" pFoldlAccLazy
33
+ ]
34
+ ]
35
+
36
+ ------------------------------------------------------------------------
37
+ -- * Test harness
38
+
39
+ main :: IO ()
40
+ main = defaultMain tests
41
+
42
+ ------------------------------------------------------------------------
43
+ -- * Utilities
44
+
45
+ isn'tBottom :: a -> Bool
46
+ isn'tBottom = not . isBottom
You can’t perform that action at this time.
0 commit comments