#!/bin/ksh -p usage() { echo "Usage: haskell [-c] program[.hs]" echo " haskell -c" echo " -c: clean away everything but source code" exit 1 } if (( $# == 0 )) ; then usage fi clean=0 if (( $# == 2 )) ; then if [ $1 != "-c" ] ; then usage fi shift clean=1 fi if (( $# != 1 )) ; then usage fi if [[ $1 == "-c" ]] ; then for i in *.hs ; do name=${i%%.hs} /usr/bin/rm -f ${name} ${name}.o Main.hi 2>&1 > /dev/null done exit 0 fi name=$1 name=${name%%.hs} if (( clean == 0 )) ; then ghc ${name}.hs -O -o $name && strip $name else /usr/bin/rm -f $name ${name}.o Main.hi 2>&1 > /dev/null fi