summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/compiler/genManyConstructors
blob: ec4abdced7948d733cf3bad2d2e1f7741930d006 (plain)
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
SIZE=10000
MODULE=ManyConstructors

# Generates a module with a large number of constructors that looks
# like this:
#
#   module ManyConstructors where
#
#   data A10000 = A0
#     | A00001
#     | A00002
#     ...
#     | A10000
#
# The point of this test is to check if we don't regress on #14657 reintroducing
# some code that's quadratic in the number of constructors in a data type.
# NB. This is not that artificial, I've seen data types of this size
# in the wild.

echo "module $MODULE where" > $MODULE.hs
echo >> $MODULE.hs
echo "data A$SIZE = A0" >> $MODULE.hs
for i in $(seq -w 1 $SIZE); do
  echo "  | A$i" >> $MODULE.hs
done