From afc2fff6d800cabb8ba3a71bda8e197c15c6ad40 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 12 Jul 2020 14:18:23 -0600 Subject: [PATCH] New language: Spago (good lord that took forever) --- backend/src/langs.ts | 20 ++++++++++++++++++++ scripts/docker-install-phase2.bash | 1 + scripts/docker-install-phase3c.bash | 3 +++ scripts/docker-install-phase4.bash | 3 +++ scripts/docker-install-phase6.bash | 22 ++++++++++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/backend/src/langs.ts b/backend/src/langs.ts index 7d13e57..e9262d7 100644 --- a/backend/src/langs.ts +++ b/backend/src/langs.ts @@ -917,6 +917,26 @@ main :- template: `html body p Hello, world! +`, + }, + purescript: { + aliases: ["purs", "pure", "ps"], + name: "PureScript", + monacoLang: "plaintext", + setup: `shopt -s dotglob; cp -R /opt/purescript/project-template/* "$PWD/"`, + repl: "spago repl", + main: "src/Main.purs", + run: `if spago build -n; then spago run -n; (echo 'import Prelude'; echo 'import Main') > .purs-repl; spago repl; else echo 'import Prelude' > .purs-repl; spago repl -d; fi`, + template: `module Main where + +import Prelude + +import Effect (Effect) +import Effect.Console (log) + +main :: Effect Unit +main = do + log "Hello, world!" `, }, python: { diff --git a/scripts/docker-install-phase2.bash b/scripts/docker-install-phase2.bash index 14d6574..ae92977 100755 --- a/scripts/docker-install-phase2.bash +++ b/scripts/docker-install-phase2.bash @@ -30,6 +30,7 @@ nano iputils-ping sudo tmux +tree vim wget diff --git a/scripts/docker-install-phase3c.bash b/scripts/docker-install-phase3c.bash index b91737b..10e16cb 100755 --- a/scripts/docker-install-phase3c.bash +++ b/scripts/docker-install-phase3c.bash @@ -43,6 +43,9 @@ php # Prolog swi-prolog +# PureScript +libtinfo5 + # Python python3 python3-pip diff --git a/scripts/docker-install-phase4.bash b/scripts/docker-install-phase4.bash index 6bbc359..3e489d9 100755 --- a/scripts/docker-install-phase4.bash +++ b/scripts/docker-install-phase4.bash @@ -67,6 +67,9 @@ npm install -g intelephense # Pug npm install -g pug-cli +# PureScript +npm install -g purescript spago + # ReasonML npm install -g bs-platform diff --git a/scripts/docker-install-phase6.bash b/scripts/docker-install-phase6.bash index 4efcf57..4e0a0cb 100755 --- a/scripts/docker-install-phase6.bash +++ b/scripts/docker-install-phase6.bash @@ -3,6 +3,27 @@ set -e set -o pipefail set -x +pushd /tmp >/dev/null + +mkdir project-template +pushd project-template >/dev/null +spago init -C +rm -rf .gitignore test +sed -i 's#, "test/\*\*/\*\.purs"##' spago.dhall +cat <<"EOF" > src/Main.spago +import Prelude + +import Effect (Effect) + +main :: Effect Unit +main = pure unit +EOF +spago build +spago repl < /dev/null +rm -rf src +popd >/dev/null +mkdir /opt/purescript +mv project-template /opt/purescript/ # Befunge tee /usr/bin/befunge-repl >/dev/null <<"EOF" @@ -133,4 +154,5 @@ while True: EOF chmod +x /usr/bin/unlambda-repl +popd >/dev/null rm "$0"