Skip to content

Installation

The bulk of the programming will be in Haskell and Rust. For both of these languages, you will need two things to get started: some way to edit your code, and some way to compile and run your programs. To keep things simple, I recommend you use the same editor for both languages. However, you're certainly welcome to use different editors if you prefer.

Getting Started with Haskell

The following instructions are if you are using your personal machine. All needed Haskell software is already installed on the instructional machines.

Step 1: Download and install the Haskell Platform.

This includes everything you need to get started---the GHC compiler, the Cabal build system, the Stack project tool, and more.

Step 2: Pick an editor or IDE.

If you are comfortable with text-based editors, both vim and emacs work well for Haskell with a bit of configuration; please search around online. If you prefer something a bit more polished:

Step 3: Install HLint.

The HLint tool provides helpful suggestions for cleaning up your code. We expect you to run HLint before submitting your homework, and to make fixes (within reason). There are a few important things to keep in mind.

  • HLint is not perfect. In rare cases, it may make suggestions that break your program. Make sure to test afterwards to make sure your program is still OK.
  • HLint typically uncovers more suggestions after you make initial changes. Make sure to run HLint again after making your changes, until you have applied all the fixes that you want to.

If you are using your personal machine, you can install Hlint using Cabal, the Haskell package manager:

cabal new-update
cabal new-install hlint

Then, run hlint source-file.hs to see hints for source-file.hs. Alternatively, it may be easier to just get the HLint executable for your machine.

Getting Started with Rust

You will need to download and install Rust whether you are working on your personal machine or on the instructional machine. (The instructional machines have some Rust tools, but we will need a bit more.) The installation should be fairly painless on all platforms, let us know if you are having difficulties.

Step 1: Download and install the latest version of Rust.

This will first install Rust's installation manager Rustup, which will then allow you to switch between different versions of Rust. In this course we will always stick with the stable version.

If you are on the instructional machines, you'll have to work around the system installation of Rust. Try the following:

wget https://sh.rustup.rs
sh index.html -y

You may have to log out and log back in again to set up the path correctly.

Step 2: Pick an editor or IDE.

If you are comfortable with text-based editors, both vim and emacs work well for Rust with a bit of configuration; please search around online. If you prefer something a bit more polished:

Step 3: Install Rustfmt and Clippy.

Rust includes some useful tools for cleaning up your code. Rustfmt formats your code so that the style is consistent. Clippy suggests places where your code can be improved or made more idiomatic. Again, these suggestions are almost always good but may break your code in rare cases---make sure to test!

You can install these tools through Rustup:

rustup component add rustfmt
rustup component add clippy

You can run these tools on your project with cargo fmt and cargo clippy.