ghci-with 674 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh -e
  2. if [ $# -lt 1 ]; then
  3. echo "Usage: $0 package [package ...]" >&2
  4. exit 1
  5. fi
  6. DIR=$(mktemp -d)
  7. PKG=Temporary
  8. touch $DIR/LICENSE
  9. cat >$DIR/$PKG.hs <<EOF
  10. module $PKG where
  11. EOF
  12. cat >$DIR/$PKG.cabal <<EOF
  13. name: $PKG
  14. version: 0.0.0
  15. license: OtherLicense
  16. license-file: LICENSE
  17. cabal-version: >= 1.10
  18. build-type: Simple
  19. library
  20. default-language: Haskell2010
  21. exposed-modules: $PKG
  22. build-depends: $1,
  23. EOF
  24. shift
  25. for DEP in $@; do
  26. cat >>$DIR/$PKG.cabal <<EOF
  27. $DEP,
  28. EOF
  29. done
  30. cat >>$DIR/$PKG.cabal <<EOF
  31. base
  32. EOF
  33. cd $DIR
  34. cabal sandbox init
  35. cabal install
  36. cabal configure
  37. exec cabal repl