1
0
mirror of https://github.com/ikoHSE/sc-task-1.git synced 2024-07-07 07:16:26 +03:00
🎒📓💻 HSE CS SE Software Construction
Go to file
2020-04-27 13:18:35 +03:00
img [ImgBot] Optimize images 2020-04-25 14:37:04 +00:00
src Fixed typo 2020-04-25 17:05:33 +03:00
test Fixed tests 2020-04-25 18:30:15 +03:00
.gitignore Added cabal file 2020-04-25 14:58:47 +03:00
LICENSE Initial commit 2020-02-02 21:25:22 +03:00
package.yaml Fixed tests 2020-02-25 17:34:16 +03:00
README.md Update README.md 2020-04-27 13:18:35 +03:00
stack.yaml Added compiler warnings 2020-02-25 18:05:38 +03:00
task.cabal Added cabal file 2020-04-25 14:58:47 +03:00

🎒📓💻 Task 1

NOTE: If you just fork this repository it will not be graded. Ask your supervisor for a special GitHub classroom URL.

How to do the task

Your task is to write a valid definition for every function declared in src/Task.hs. All functions have a comment describing what the function needs to do with some examples.

There are predefined tests for you to check your answer. You can look at the tests for some more usage examples in test/Tests.hs.

After defining all functions you then need to commit and push your code to your repository. An automated script will then check your solution and give you feedback as a CI result in your GitHub repository.

Prerequisites

Haskell Stack

First of all, you need to install haskell stack. To do that you can follow the installation instructions on the website.

Stack will manage to install the compiler and all required libraries when you try to compile a Haskell stack project. (The first time it might take a while, but when you will try to run it again, it will use the already installed tools).

Stack is also a sort of meta build system. It is "meta" because stack doesn't build anything -- it tells cabal how to build your project with the installed compiler and libraries. Cabal is to Haskell what the CMake is to C++.

Git

If you are running macOS or Linux you should already have some version of git installed on your system. If you do not, or if you are running windows, you will need to install git. You can do so by following this git installation tutorial.

Cloning your project

After you follow the special URL, you should finally end up on your github project.

You will then want to grab the cloning URL:

And in you terminal, navigate to where you would like to store your project and clone the git repo:

git clone https://github.com/hse-cs-2020/sc-task-1-ilyakooo0.git

Making sure it builds

After you have cloned your project you should make sure you have everything set up and working properly.

Navigate to the project folder and run the following command:

stack test

This should download the compiler, download all necessary libraries and run the test in your project.

IDE

The easiest way to develop is to use the IntelliJ plugin for Haskell.

Unfortunately, the latest versions of the plugin are not available in the IntelliJ marketplace, so it is recommended that you download it from the "Releases" tab on github:

You then need to install it from disk:

To install and use it you can follow the instructions given in the project readme.

NOTE: You need to make sure the project builds before importing

NOTE: You need to choose "Project from Existing Sources..." in IntelliJ

When you first open a project, IntelliJ will download and build all the required tools to give you feedback about your project. (This may take a while, but is only required once)

Build and test

Unfortunately, IntelliJ plugin for Haskell doesn't currently support building your project directly from the IDE, so you will have to build your project and run tests from the terminal.

All subsequent commands are assumed to be run when the current directory is the root of your project.

After you have installed stack, you can build your project by running stack build in the directory of your project. This will build the code of your library.

To run tests on your code you can write stack test.

NOTE: you don't have to write stack build if you want to test your project. Running stack test will automatically build any necessary modules.

You can experiment with your functions by running stack ghci. This will build your library and launch an interactive shell with all of the functions already loaded. You can then just call your functions directly.

Lifehack

If you try to display your types in the console, you will get errors.

To get rid of the errors you have to add deriving Show to the definition like so:

data Foo = Bar
  deriving Show

Submitting you solution

You can submit the solution to your solution to GitHub using IntlliJ.

To do this you can go to "VCS > Commit...":

After that you will need to write a commit message.

NOTE: Don't forget to push your commit. You can commit and push at the same time.

FAQ

Can I add extra functions in the Task.hs file?

Yes, you can, but you can not remove existing functions.