From 3246ed6781fa3fc60d101ebd9ab392fe07a448b3 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Fri, 16 Oct 2020 23:57:45 -0400 Subject: [PATCH] Added haskell support --- lxc/execute | 3 +++ lxc/executors/haskell | 3 +++ lxc/test_all_lxc | 2 ++ lxc/tests/test.hs | 1 + lxc/versions | 3 +++ readme.md | 6 ++++++ 6 files changed, 18 insertions(+) create mode 100644 lxc/executors/haskell create mode 100644 lxc/tests/test.hs diff --git a/lxc/execute b/lxc/execute index e19b9f4..2582a9f 100755 --- a/lxc/execute +++ b/lxc/execute @@ -117,6 +117,9 @@ case "$lang" in "typescript" | "ts") bin=typescript ;; +"haskell" | "hs") + bin=haskell + ;; *) echo "invalid language" exit diff --git a/lxc/executors/haskell b/lxc/executors/haskell new file mode 100644 index 0000000..d2902b1 --- /dev/null +++ b/lxc/executors/haskell @@ -0,0 +1,3 @@ +cd /tmp/$2 +timeout -s KILL 10 ghc -dynamic -o binary code.code +runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/test_all_lxc b/lxc/test_all_lxc index dd7453f..f3d6dc3 100755 --- a/lxc/test_all_lxc +++ b/lxc/test_all_lxc @@ -45,3 +45,5 @@ echo 'testing python2' ../execute python2 test2.py echo 'testing python3' ../execute python3 test3.py +echo 'testing haskell' +../execute haskell test.hs diff --git a/lxc/tests/test.hs b/lxc/tests/test.hs new file mode 100644 index 0000000..2d96bbc --- /dev/null +++ b/lxc/tests/test.hs @@ -0,0 +1 @@ +main = putStrLn "Hello, World" diff --git a/lxc/versions b/lxc/versions index 1e36ea3..7078168 100755 --- a/lxc/versions +++ b/lxc/versions @@ -66,3 +66,6 @@ echo '---' echo 'typescript' lxc-attach --clear-env -n piston -- /bin/bash -l -c "tsc --version" echo '---' +echo 'haskell' +lxc-attach --clear-env -n piston -- /bin/bash -l -c "ghc --version" +echo '---' diff --git a/readme.md b/readme.md index b3bc4ca..ac7a226 100644 --- a/readme.md +++ b/readme.md @@ -218,6 +218,11 @@ make echo 'export PATH=$PATH:/opt/lua/lua54/src' >> /opt/.profile source /opt/.profile +# install haskell +# final binary: /usr/bin/ghc +# get version: /usr/bin/ghc --version +apt install ghc + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i @@ -323,6 +328,7 @@ If an invalid language is supplied, a typical response will look like the follow - elixir - emacs - go +- haskell - java - julia - kotlin