To install HAAP in a new sandbox, simply run:
cabal sandbox init
cabal sandbox add-source packages/*
cabal install HAAP.cabal
For JavaScript animations you need to have ghcjs installed:
- install
ghcjs
from https://github.com/commercialhaskell/stack/blob/master/doc/ghcjs.md - add
ghcjs
to your path - install the HAAP ghcjs packages
cabal install --ghcjs packages/codeworld-haap-api packages/ghcjs-extras packages/Xterm
To try HAAP in a new Docker container, simply run:
docker run -i -t hugopacheco/haap:latest /bin/bash
Since this container has no X window system, it is often useful to bind a directory in your host system, say ~/Desktop
, to a path inside your container, say /Desktop
, by running the container with the additional argument:
docker run -v ~/Desktop:/Desktop -i -t hugopacheco/haap:latest /bin/bash
You can then try our examples.
A simple hello world example with a simple Hspec specification and Hakyll webpage generation:
cd examples/helloworld
cp ../../cabal.sandbox.config .
cabal exec -- ghc helloworld.hs
./helloworld
The resulting page is generated at _site/index.html
.
Check the pre-generated result of this helloworld example.
A minimal example that showcases code analysis tools and CodeWorld integration:
cd examples/minimalistic
cp ../../cabal.sandbox.config .
cabal exec -- ghc minimalistic.hs
./minimalistic
./minimalistic
The resulting page is generated at _site/index.html
.
Check the pre-generated result of this minimalistic example.
An example that showcases xterm.js integration:
cd examples/xterm
cp ../../cabal.sandbox.config .
cabal exec -- ghc xterm.hs
./xterm
The resulting page is generated at _site/index.html
.
Check the pre-generated result of this xterm example.
An example that showcases a CodeWorld game using JavaScript Web Workers:
cd examples/gameworker
cp ../../cabal.sandbox.config .
cabal exec -- ghc gameworker.hs
./gameworker
The resulting page is generated at _site/index.html
.
Note that, by default, some browsers (such as Google Chrome) may block local JavaScript Web Workers for security reasons.
Check the pre-generated result of this gameworker example.
A mockup of the Laboratórios de Informática I class feedback page.
cd examples/plab
cp ../../cabal.sandbox.config .
cabal exec -- ghc plab.hs -ioracle
./plab
./plab
The resulting page is generated at _site/index.html
.
Check the pre-generated result of this plab example.