Fix Haste build.
Chris Pressey
5 years ago
8 | 8 |
echo "ghc not found, not building $PROG.exe"
|
9 | 9 |
fi
|
10 | 10 |
|
11 | |
#if command -v hastec >/dev/null 2>&1; then
|
12 | |
# echo "building $PROG.js with hastec"
|
13 | |
# (cd src && hastec --make HasteMain.hs -o ../demo/$PROG.js) || exit 1
|
14 | |
#else
|
15 | |
# echo "hastec not found, not building $PROG.js"
|
16 | |
#fi
|
|
11 |
# For this to work, you need hastec installed.
|
|
12 |
# You also need parsec installed in a way that haste can use it:
|
|
13 |
#
|
|
14 |
# haste-cabal install parsec-3.1.1
|
|
15 |
#
|
|
16 |
# Later versions might not work. For example, 3.1.13.0 fails to build for me at:
|
|
17 |
# Preprocessing library generic-deriving-1.12.3...
|
|
18 |
# src/Generics/Deriving/TH/Pre4_9.hs:177:20:
|
|
19 |
# parse error on input ‘->’
|
|
20 |
#
|
|
21 |
# You also need random installed in a way that haste can use it:
|
|
22 |
#
|
|
23 |
# haste-cabal install random-1.1
|
|
24 |
#
|
|
25 |
|
|
26 |
if command -v hastec >/dev/null 2>&1; then
|
|
27 |
echo "building $PROG.js with hastec"
|
|
28 |
(cd src && hastec --make HasteMain.hs -o ../demo/$PROG.js) || exit 1
|
|
29 |
else
|
|
30 |
echo "hastec not found, not building $PROG.js"
|
|
31 |
fi
|
17 | 32 |
|
18 | 33 |
./build-packages.sh
|
4 | 4 |
import Haste.Events
|
5 | 5 |
|
6 | 6 |
import Language.Robin.Env (mergeEnvs)
|
7 | |
import Language.Robin.Parser (parseRobin)
|
|
7 |
import Language.Robin.Parser (parseToplevel)
|
8 | 8 |
import Language.Robin.Intrinsics (robinIntrinsics)
|
9 | 9 |
import Language.Robin.Builtins (robinBuiltins)
|
10 | 10 |
import qualified Language.Robin.TopLevel as TopLevel
|
|
17 | 17 |
where
|
18 | 18 |
execute = do
|
19 | 19 |
Just program <- getValue progElem
|
20 | |
case parseRobin program of
|
|
20 |
case parseToplevel program of
|
21 | 21 |
Right topExprs -> do
|
22 | 22 |
let env = (mergeEnvs robinIntrinsics robinBuiltins)
|
23 | 23 |
let (env', reactors, results) = TopLevel.collect topExprs env [] []
|