riju/langs/unison.yaml

74 lines
1.5 KiB
YAML

id: "unison"
aliases:
- "ucm"
name: "Unison"
install:
prepare:
apt:
- haskell-stack
manual: |
mkdir -p "${pkg}/opt/unison/skel"
install -d "${pkg}/usr/local/bin"
git clone https://github.com/unisonweb/unison.git
pushd unison
stack build
cp "$(stack exec which unison)" "${pkg}/usr/local/bin/"
popd
pushd "${pkg}/opt/unison/skel"
"${pkg}/usr/local/bin/unison" -codebase . init
LESS="+q" "${pkg}/usr/local/bin/unison" -codebase . <<< 'pull https://github.com/unisonweb/base:.trunk .base'
popd
setup: |
shopt -s dotglob
cp -R /opt/unison/skel/* ./
repl: |
unison -codebase .
input: |
DELAY: 10
find : [a] -> [a]
output: |
base.List.reverse
# runProg implementation courtesy of Robert Offner from Unison Slack!
main: "main.u"
template: |
use io
runProg: '{IO, Exception} a -> '{IO} ()
runProg f = 'let
printErr err = match err with
Failure _ errMsg _ -> handle putBytes (stdHandle StdErr) (toUtf8 errMsg) with cases
{raise _ -> _} -> ()
{_} -> ()
match catch f with
Left err -> printErr err
Right _ -> ()
main: '{IO} ()
main = runProg 'let
printLine "Hello, world!"
createEmpty: ""
run: |
unison -codebase . run.file main.u main
echo "Type 'load main.u' at the repl prompt to bring variables into scope."
unison -codebase .
scope:
code: |
x = 123 * 234
input: |
DELAY: 15
load main.u
DELAY: 5
add x
DELAY: 5
display x
timeoutFactor: 4