Allele Dev

Tutorial: Building Web Services in Haskell!
Communication, Expression, and Types: Your Compiler as an Ally

Tutorial: Building Web Services in Haskell!

Haskell is an interesting language with *a lot* of literature. If you want to learn about the type system, the compiler, category theory, parsing, error-handling strategies, representing JSON and other little languages - great! But, what if you wanted to build an application? There's a scarcity of resources that guide you through the process of creating a full Haskell application. Putting together all the pieces can be daunting!

This workshop aims to address that problem.

In 3.5 hours, we'll walk through the process of building a simple HTTP/JSON API in Haskell while leveraging several great libraries. We'll walk through the initial project setup, dependency management, directory structuring, JSON [en|de]coding, endpoint registration, logging, and ad-hoc testing.

This workshop assumes that:

* You've used Haskell before, to the extent of having completed the first 8 weeks of CIS194:
* You're familiar with HTTP
* You're familiar with JSON
* You're comfortable with a command line interface

If you're not comfortable with Functor/Monad/Applicative and related abstractions, that's okay! If you're still getting used to Haskell's type systems, that's okay, too! We'll make use of them in fairly simple ways, and I'll explain as we go. They'll be far from the focus of this talk.

All code used in this workshop will be made available in a git repository, along with instructions to set up the workshop development environment on Linux, Mac OS X, and Windows.

Communication, Expression, and Types: Your Compiler as an Ally

Communication is hard. Communication is even harder when you have to ensure that computers, team mates, and users are all getting the same message. This is at the heart of programming.

A great ally in this effort is the compiler and its type checker. A good compiler allows us to express ourselves in great detail, while ensuring that our meaning is consistent. Unfortunately, we've been taught that there's shame in making mistakes. Type errors become a source of pain and frustration rather than a dialogue in search of meaning. I hope to help you befriend your compiler, and to convince compiler writers that friendly compilers are crucial.

This talk uses Haskell as a medium to explore the intersection of type theory, effective communication, and software development. You don't need to be familiar with Haskell or type theory to understand this talk. Further, the core concepts of this talk are applicable to many languages, gradually or statically typed. Using a combination of live coding and narrative, we'll learn to understand what the compiler is trying to tell us as we encode progressively richer assumptions in a small program.

Talk objectives:

Briefly, I hope that I can teach attendees the following:

* Effective communication: refining a message, removing ambiguity, removing noise

* Basic type system terminology: type checker, sum types, product types, recursive types, polymorphic types

* Haskell syntax: pattern matching, deconstruction, data type definition, function definition

* Reading type signatures and type errors

* Refactoring with the help of a type checker

* Optional data, nullability, and the Maybe type

* Error-handling with Either types

* Abstraction safety as it relates to consistency

* Briefly, next steps: the rich tapestry of logic, math, programming, philosophy, and communication

Target audience:

- Developers interested in learning more about using type systems in practice, communicating better, or who are Haskell-curious.

About Allele

Alelle is a software developer with an interest in programming languages, type theory, social structures, and Haskell. By day, they help write backend services in Haskell for Eduphoria. By night, they'll read research papers, enjoy a great deal of laziness, and make sure the cats are happy and fed. They listen to chip tune and love 4-arrow dance games.

Github: cabrera

Twitter: @queertypes

Back to conference page