-
-
Notifications
You must be signed in to change notification settings - Fork 388
/
Copy pathMultiLayerModules.sh
executable file
·34 lines (34 loc) · 1.05 KB
/
MultiLayerModules.sh
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
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Generate $DEPTH layers of modules with $WIDTH modules on each layer
# Every module on layer N imports all the modules on layer N-1
# MultiLayerModules.hs imports all the modules from the last layer
DEPTH=15
WIDTH=40
cat >hie.yaml << EOF
cradle:
direct:
arguments:
EOF
for i in $(seq -w 1 $WIDTH); do
echo "module DummyLevel0M$i where" > DummyLevel0M$i.hs;
echo " - DummyLevel0M$i.hs" >> hie.yaml;
done
for l in $(seq 1 $DEPTH); do
for i in $(seq -w 1 $WIDTH); do
echo "module DummyLevel${l}M$i where" > DummyLevel${l}M$i.hs;
echo " - DummyLevel${l}M$i.hs" >> hie.yaml;
for j in $(seq -w 1 $WIDTH); do
echo "import DummyLevel$((l-1))M$j" >> DummyLevel${l}M$i.hs;
done
done
done
case "$1" in
'--th')
echo "{-# LANGUAGE TemplateHaskell #-}" > MultiLayerModules.hs
;;
esac
echo "module MultiLayerModules where" >> MultiLayerModules.hs
echo " - MultiLayerModules.hs" >> hie.yaml;
for j in $(seq -w 1 $WIDTH); do
echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModules.hs;
done