blob: 0d9648d7049e3f9860a9bedeaef3dd84d38aeef0 (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/env bash
###
### typecheck a given target
###
### > typecheck.sh <target..>
###
### Uses repl.sh to provision the environment for target, then runs the
### appropriate typechecker for the given module.
###
help() {
sed -rn 's/^### ?//;T;p' "$0"
}
if [[ $# == 0 ]] || [[ "$1" == "-h" ]]; then
help
exit 1
fi
target="$1"
# Determine file extension
ext="${target##*.}"
case "$ext" in
py)
# Python: use mypy via repl.sh environment
repl.sh --cmd "python -m mypy $target" "$target"
;;
hs)
# Haskell: use ghc -fno-code
# This would need the right environment from repl.sh
echo "Haskell typechecking not yet implemented in typecheck.sh"
echo "Use 'bild $target' to build and typecheck"
exit 1
;;
*)
echo "Unknown file extension: $ext"
echo "Typechecking not supported for this file type"
exit 1
;;
esac
|