Setting up your Haskell Toolchain in 2023
You can read all the Haskell articles you want, but unless you write the code for yourself, you'll never get anywhere! But there are so many different tools and ideas floating around out there, so how are you supposed to know what to do? How do you even get started writing a Haskell project? And how can you make your development process as efficient as possible?
Setup.hs is designed to help you answer those questions! Newcomers to Haskell will learn all the basics of building and running your code. More experienced Haskellers will get some new tools for managing all your programs, as well as some tips for integrating Haskell features into your code editor!
Here's what you'll learn in the course:
- How to install and manage all of the core Haskell tools (GHC, Cabal, Stack)
- What components you need in your Haskell project and how you can build and run them all
- How to get your editor to use advanced features, like flagging compilation errors and providing autocomplete suggestions.
We'll do all of this in a hands-on way with detailed, step-by-step exercises!
Course Content and Outline
The course content consists of 3 elements:
- Video Lectures
- Programming Exercises
- Walkthrough Videos
In video lectures, we'll introduce the core concepts of the lesson, including a breakdown of some of the implementation details.
Then you'll get the chance to try the concepts for yourself with our detailed programming exercises. These exercises are the most important part of the course! By writing the code, running the commands, and applying the concepts yourself, you'll build up the confidence to use these ideas in your own projects.
Finally, the walkthrough videos will show these concepts in action, so you can follow along in case you get stuck. There's a separate series of walkthrough videos for Windows, MacOS, and Linux, since each of these have their own setup quirks!
This short course consists of roughly three different parts. Here are the different areas you'll cover:
Install Haskell Tools
Haskell has a surprising number of programs working under the hood. And all of them get updated quite regularly, resulting in a lot of version combinations! But in the last couple years, GHCup has made it easier than ever to keep all these tools up to date. The first thing you'll learn in the course is how to use GHCup to get all your tools installed and how to switch between different versions.
Understand Haskell Project Structure
Once everything's installed, we'll explore what it actually looks like to create a Haskell project using Stack, the easiest and most popular Haskell build system. You'll learn the structure of a Haskell project, with its library, executables, test suites and benchmarks. You'll use Stack to build, run and test your Haskell code using these different components.
Integrate Editors with Haskell
As early as 2018 I had wanted to do a blog series on Haskell IDE integrations. But I mostly abandoned the idea because it was really quite difficult. Extensions and plugins existed, but they were always pegged to a specific GHC version, and they often lagged behind the latest release by quite a bit.
But now things are much easier thanks to the Haskell Language Server. This tool comes with GHCup, and it enables a lot of important features that can be used across many IDEs. To finish up the course, you'll work with 3 different code editors and learn how to enable Haskell features using Haskell Language Server. This will enable you to get immediate feedback on your code as you're writing it, which can be **extremely** helpful for a beginner!
For more details, see the full outline and FAQ below!
James is a Software Engineer living in San Francisco, CA. He first discovered Haskell in college, but began using it consistently since 2015. His Haskell experience blends multiple side projects as well as professional work. In late 2016, he began the Monday Morning Haskell blog, where he publishes new Haskell content every week.
Preview01 - Introduction & GHCup (26:42)
Start02 - GHC & Compilation (26:13)
Start03 - Stack & Cabal (25:48)
Start04 - The Cabal File & Executables (20:04)
Start05 - The Project Library (24:49)
Start06 - Test Suites & Benchmarks (39:23)
Start07 - Extra Dependencies (21:37)
Start08 - Haskell Language Server (10:45)
Start09 - VS Code Integration (20:13)
Start10 - Vim Integration (23:29)
Start11 - Emacs Integration (24:49)
Start12 - Course Conclusion (5:28)