aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/dhall_check.sh
blob: 6fc7fd15a92752992b87bcc60f74f35b62dd7972 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash

pushd () {
  command pushd "$@" > /dev/null
}

popd () {
  command popd "$@" > /dev/null
}

go() {
  local ERROR=0;
  for file in $(find -type f -name "*.dhall"); do
    pushd $(dirname $file);
    cat $(basename $file) | dhall --explain resolve > /dev/null;
    echo "Type checking ${file}"
    if [ "$?" -ne "0" ]; then
      echo "Failed to resolve $file"
      ERROR=1;
    fi;
    popd;
  done;
  exit $ERROR;
}

go