#!/bin/bash
# Todo: Find a way to make this not suck.

[[ -e test/quackCheck.hs ]] || { echo "Are you running me from the wrong directory?"; exit 1; }

find . -name '*.hs' -exec bash -c '
grep -v "^module " "$1" > quack.tmp.hs
./test/quackCheck.hs +names quack.tmp.hs
' -- {} \; 2>&1 | grep -i FAIL
result=$?
rm -f quack.tmp.hs hugsin

if [[ $result == 0 ]]
then
  exit 1
else
  exit 0
fi