Last active
June 5, 2019 18:26
-
-
Save bgamari/4e80c34e6a9aca77c4112d34a7c10bb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
set -e | |
rm -f *.hi *.o | |
args="-O -package-env -" | |
#args="$args -ddump-hi-diffs -ddump-hi" | |
cat >Z.hs <<EOF | |
module Z where | |
class Hello a where | |
hello :: a -> String | |
instance Hello () where | |
hello _ = "hello" | |
EOF | |
cat >Y.hs <<EOF | |
module Y(Hello(..)) where | |
import Z | |
EOF | |
cat >X.hs <<EOF | |
module X(x) where | |
import Y | |
x = print (hello ()) | |
EOF | |
compile() { | |
echo "===================== $1 ===============================" | |
ghc -c $args $1.hs | |
echo >> $log | |
echo "===================== $1 ===============================" >> $log | |
ghc --show-iface $1.hi >> $log | |
} | |
echo | |
echo | |
echo "###############################################" | |
echo " before " | |
echo "###############################################" | |
log=before | |
rm -f $log | |
compile Z | |
compile Y | |
compile X | |
ls --time-style=full-iso -lh *.hi | |
sleep 2 | |
cat >Z.hs <<EOF | |
module Z where | |
class Hello a where | |
hello :: a -> String | |
instance Hello () where | |
hello _ = "hi" | |
EOF | |
echo | |
echo | |
echo "###############################################" | |
echo " after " | |
echo "###############################################" | |
log=after | |
rm -f $log | |
compile Z | |
compile Y | |
compile X | |
ls --time-style=full-iso -lh *.hi | |
echo | |
echo | |
echo "###############################################" | |
echo " diff " | |
echo "###############################################" | |
meld before after |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment