Applied Haskell by Michael Snoyman

Applied Haskell

Michael Snoyman

Introduction

In this training session, we will cover modern Haskell programming best practices, with an emphasis on creating real world, production-ready applications. This will include program structure, recommended libraries, and tooling configuration. The techniques will be relevant to most programming domains, including network programming, concurrent applications, and data science. Familiarity with Haskell syntax and basic programming ability is assumed, and ample Q&A sections will be available.

Relevancy

Many developers are at a point where they are somewhat familiar with the syntax and features of the Haskell programming language, but struggle using this knowledge to build real-world, production applications. Building real-world software requires more than just familiarity with the language — it requires knowledge of how to structure large-scale Haskell programs, how to use the best libraries in the vast Haskell ecosystem to solve the problems of modern application development, and how to setup and configure tooling.

This course takes Haskell developers from being able to write toy programs and Haskell snippets, to knowing how to structure and develop complex, real-world applications that compete with the best of what imperative and OOP have to offer, but with faster time-to-market and fewer bugs.

Benefits

After attending this workshop, attendees will be able to build commercial-grade applications in Haskell, confident they are structuring programs in a scalable way, and leveraging well-supported, production-ready, high-performant Haskell libraries. Furthermore, attendees will have the skills and knowledge to continue advancing their Haskell skills from available online material.

Companies who wish to train their Haskell developers on best practices for building commercial software (quickly and with fewer bugs) are encouraged to send their teams to this workshop.

Concepts & Skills

Attendees will learn the following concepts:

  • Monadic effects & MTL

  • Non-strict evaluation, strictness

  • Debugging, profiling, and optimizing

  • Structure of Haskell programs

  • Structure of Haskell libraries

  • Design patterns for Haskell

  • Performance "gotchas"

  • Best practices for type classes, MTL, Free, IO, non-strictness, strictness, etc.

Attendees will learn the following skills:

  • How to understand evaluation of Haskell code

  • How to use common Haskell data structures

  • How to write test suites

  • How to use MTL to compose different monadic effects

  • How to detect and fix time and space leaks caused by laziness

  • How to read, understand, and use libraries

  • How to debug, profile, and optimize Haskell programs

  • How to write concurrent applications

  • How to introduce strictness to increase performance

  • How to use streaming libraries like Conduit for high-performance processing

  • How to structure Haskell programs and libraries

  • How to select and evaluate Haskell libraries

Prerequisites

This course assumes prior knowledge of basic programming in Haskell. You should ensure that you are comfortable with the following topics to maximize your takeaway from this course:

  • ADTs

  • Type classes

  • Functor/Applicative/Monad

  • Folds

  • Basic understanding of laziness and Haskell’s evaluation model

  • Basic usage of Stack (see https://haskell-lang.org/get-started)

If you would like to brush up on any topics, the book Haskell Programming from First Principles is highly recommended.

Course Outline

  • Tooling overview

    • Build tools

    • Project configuration

    • Library discovery

    • Online resources

  • Strictness, laziness, and evaluation of Haskell code

  • Data structures

    • ByteString

    • Text

    • Vector

    • Map/HashMap

    • Set/HashSet

  • Monad transformers

    • Basic transformers

    • MTL

    • MonadUnliftIO

    • RIO

  • Exceptions

  • Mutable variables

    • IORef

    • MVar

    • STM

  • Concurrent programming

  • Testing (hspec)

  • Profiling

  • Best practices advice

Optional topics, depending on time:

  • External processes

  • Streaming data (conduit)

  • HTTP requests

  • Data formats: JSON, YAML

  • Web services (Warp)

  • Primitive Haskell

  • Covariance and contravariance

Instructor Bio

Michael Snoyman is the founder and lead developer of multiple Haskell open source projects, including Yesod, Conduit, Stack, and Stackage. His main interests are creating developer-friendly, high performance libraries that minimize bugs. Michael is VP of Engineering at FP Complete, where he focuses on using Haskell and modern devops to help projects make it to market faster and with fewer bugs.