Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
MUHAMMAD YUSUF HARAHAP's avatar
MUHAMMAD YUSUF HARAHAP authored
Implement material rating

See merge request !25
6703d026
History

Haskelian

Haskelian is a site where you can share materials, written almost entirely with Haskell

Access Here: https://pjpwtnstqbgxyyylklgzbsxxfjmoouhr.ihpapp.com

Currently this web app is under construction. However, you can contribute to it.

This web app currently has these features:

  1. Blog
  2. Login

How to set up the local environment

It is recommended that you use linux to develop this project. WSL can be used, but you may run into issues.

Assuming that you are using linux, you can follow the steps below to set up the local development environment.

If you don't have curl and git already, you must install them using these commands

sudo apt update
sudo apt upgrade
sudo apt install git curl make -y

Assuming you are not using the Nix OS, you will need to install Nix. To install Nix, use this command

curl -L https://nixos.org/nix/install | sh

After using this command, you will see the next instruction on the terminal screen. Perform that instruction before going onto the next step.

After following the instruction, add this line to the rc file of your shell (usually .bashrc) so that linux will run the nix-profile automatically

. ~/.nix-profile/etc/profile.d/nix.sh

For ubuntu users (and other similar distros) you can use the command below to edit the bashrc file.

nano ~/.bashrc

Running Test Suite Locally

Currently, only the Unit Test works perfectly. To run them, you must first install GHC, then install test-framework, the test orchestrator and other needed modules. After that you can compile the test files and execute them with ghc.

Ubuntu comes with GHC so that you don't need to install it again. Assuming you are running on Ubuntu, simply follow these steps to install the needed modules:

cabal update
cabal install test-framework --lib
cabal install test-framework-quickcheck2
cabal install test-framework-hunit

Keep in mind that you should not perform these cabal update and installs on a directory where a .cabal file exists. It will return an error if you do that. Instead, cd to any folder that does not have a .cabal file, then run the commands.

After installing the needed modules, you can then compile the test file and specifying the packages like below. Example can be changed according to your specifications.

ghc -package test-framework -package test-framework-quickcheck2 -package test-framework-hunit -package HUnit -package QuickCheck -threaded Example.hs -o Example -v

The running is similar to running a QuickCheck test since test-framework is actually a combination of that.

./Example --maximum-generated-tests=5000 +RTS -N2

For more info refer to these documentations:

For the test framework itself

https://hackage.haskell.org/package/test-framework

For HUnit

https://hackage.haskell.org/package/HUnit

For QuickCheck2

https://wiki.haskell.org/Introduction_to_QuickCheck2

https://hackage.haskell.org/package/QuickCheck

g