Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #!/usr/bin/bash
  2.  
  3. set -e
  4. rm -f *.hi *.o
  5. args="-O -package-env -"
  6. #args="$args -ddump-hi-diffs -ddump-hi"
  7.  
  8. cat >Z.hs <<EOF
  9. module Z where
  10. class Hello a where
  11. hello :: a -> String
  12. instance Hello () where
  13. hello _ = "hello"
  14. EOF
  15.  
  16. cat >Y.hs <<EOF
  17. module Y(Hello(..)) where
  18. import Z
  19. EOF
  20.  
  21. cat >X.hs <<EOF
  22. module X(x) where
  23. import Y
  24. x = print (hello ())
  25. EOF
  26.  
  27. compile() {
  28. echo "===================== $1 ==============================="
  29. ghc -c $args $1.hs
  30.  
  31. echo >> $log
  32. echo "===================== $1 ===============================" >> $log
  33. ghc --show-iface $1.hi >> $log
  34. }
  35.  
  36. echo
  37. echo
  38. echo "###############################################"
  39. echo " before "
  40. echo "###############################################"
  41. log=before
  42. rm -f $log
  43. compile Z
  44. compile Y
  45. compile X
  46. ls --time-style=full-iso -lh *.hi
  47. sleep 2
  48.  
  49. cat >Z.hs <<EOF
  50. module Z where
  51. class Hello a where
  52. hello :: a -> String
  53. instance Hello () where
  54. hello _ = "hi"
  55. EOF
  56.  
  57. echo
  58. echo
  59. echo "###############################################"
  60. echo " after "
  61. echo "###############################################"
  62. log=after
  63. rm -f $log
  64. compile Z
  65. compile Y
  66. compile X
  67. ls --time-style=full-iso -lh *.hi
  68.  
  69. echo
  70. echo
  71. echo "###############################################"
  72. echo " diff "
  73. echo "###############################################"
  74. meld before after
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement