Real World Halogen

<- Home

Functional languages like PureScript, ReasonML, and Elm offer powerful features to manage complexity and reliably design, build, and refactor apps of any size.

PureScript is a strongly-typed, pure functional language. Most PureScript users compile to JavaScript and develop single-page web apps, though other backends exist and it’s been used to build command line applications, web servers, and more. PureScript offers powerful features to manage complexity and help you reliably design, build, and refactor apps of any size.

The most popular single-page app framework in PureScript is the component-based halogen, though many commercial users migrating from React code bases will use react-basic instead, and fans of Elm might reach for spork.

This guide will walk you through how to design and build a real world Halogen application in PureScript. I’ll describe the design principles I use as a professional PureScript developer to write industrial apps, and we’ll put them to work to build Conduit, a social blogging app similar to Medium. This repo also contains the highly-commented source code for the app so you can see exactly how these principles translate to code.

Table of Contents

  1. Introduction
  2. What Are We Building?
  3. Design Data & Pure Functions
  4. Push Effects To The Edges
  5. Using Halogen Components
  6. A Tour Of The Implementation

Prerequisites

This is not a gentle introduction to PureScript or Halogen. It’s intended for advanced beginners and intermediate PureScript developers who know how to build Halogen components but may not yet know how to build real world applications in the language & framework. If you are not yet familiar with the language or with Halogen, I recommend working through resources like PureScript By Example and the Halogen guide first.

A word of caution

This walkthrough may not be completely in sync with the code. It covers higher-level topics and will only be updated when there are major changes to the underlying implementation. If you notice that something has fallen out of sync, please open an issue or pull request!