aboutsummaryrefslogtreecommitdiffstats
path: root/aoc
blob: 350305766f9c0d2a806aa0c76632d44ebaa8bdc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

DAY="${1}"
INPUT="${2:-input.txt}"

if [ -z "${DAY}" ]; then
    echo "usage: ${0} <daydir> [inputfile]"
    exit 1
fi

set -euo pipefail

cd "${DAY}"
if [ ! -f "${INPUT}" ]; then
    echo "${INPUT} not found in ${DAY}"
    exit 1
fi

ghc -O2 ../utils.hs main.hs && (cat "${INPUT}" | ./main)