Ticket #4143: SetBug3over8.hs

File SetBug3over8.hs, 366 bytes (added by japple, 3 years ago)

A bug that can be triggered with a Data.Set of size 3/8 * maxBound

Line 
1module SetBug3over8 where
2
3import qualified SetLocalInt16 as S
4import Data.Int
5
6big :: Int16
7big = maxBound
8
9almostBig :: Int16
10almostBig = (big `div` 2 + 1) `div` 2
11
12almostBigSet = S.fromDistinctAscList [1..almostBig]
13smallSet = S.fromList $ take (fromIntegral (almostBig`div`2)) [0,(-1)..]
14violation = S.union almostBigSet smallSet
15
16main = print $ S.size violation