blob: 39c75e138281372c1d482bf91604baa1f741a1ad (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env bash
red="$(echo -e '\033[91m')"
green="$(echo -e '\033[92m')"
yellow="$(echo -e '\033[93m')"
blue="$(echo -e '\033[94m')"
purple="$(echo -e '\033[95m')"
cyan="$(echo -e '\033[96m')"
default="$(echo -e '\033[0m')"
arrow="s/->/${purple}&${default}/g;"
arrow_double="s/=>/${purple}&${default}/g;"
bracket_left="s/\[\([^09]\)/${blue}[${default}\1/g;"
bracket_left_double="s/\[\([^\[0-9]\)/${blue}[${default}\1/g;"
bracket_right="s/\]/${blue}&${default}/g;"
bullet="s/•/${yellow}&${default}/g;"
calc_operators="s/[+\-\/*]/${purple}&${default}/g;"
char="s/'\\?.'/${cyan}&${default}/g;"
double_colon="s/::/${purple}&${default}/g;"
error="s/error:/${red}error${default}:/g;"
fancy_quotes="s/‘[^’]*’/${cyan}&${default}/g;"
interactive="s/^<[^>]*>/${yellow}&${default}/g;"
line_numbers="s/([0-9]*):([0-9]*)/${blue}&${default}/g;"
load_done="s/done./${green}&${default}/g;"
load_failed="s/^Failed, modules loaded/${red}&${default}/g;"
parenthesis="s/[{}()]/${blue}&${default}/g;"
string="s/\"[^\"]*\"/${yellow}&${default}/g;"
exec "$(command -v ghc)" --interactive ${1+"${@}"} 2>&1 |
sed " \
$arrow \
$arrow_double \
$bracket_left \
$bracket_left_double \
$bracket_right \
$bullet \
$calc_operators \
$char \
$double_colon \
$error \
$fancy_quotes \
$interactive \
$line_numbers \
$load_done \
$load_failed \
$parenthesis \
$string \
"
|