/purescript-book

Sources for the PureScript book

Primary LanguagePureScript

PureScript by Example

This repository contains a community fork of PureScript by Example by Phil Freeman, also known as "the PureScript book". This version differs from the original in that it has been updated so that the code and exercises work with up-to-date versions of the compiler, libraries, and tools. Some chapters have also been rewritten to showcase the latest features of the PureScript ecosystem.

If you enjoyed the book or found it useful, please consider buying a copy of the original on Leanpub.

Translations: 日本語 (Japanese)

Status

This book is being continuously updated as the language evolves, so please report any issues you discover with the material. We appreciate any feedback you have to share, even if it's as simple as pointing out a confusing section that we could make more beginner-friendly.

Unit tests are also being added to each chapter so you can check if your answers to the exercises are correct. See #79 for the latest status on tests.

About the Book

PureScript is a small, strongly, statically typed programming language with expressive types, written in and inspired by Haskell, and compiling to Javascript.

Functional programming in JavaScript has seen quite a lot of popularity recently, but large-scale application development is hindered by the lack of a disciplined environment in which to write code. PureScript aims to solve that problem by bringing the power of strongly-typed functional programming to the world of JavaScript development.

This book will show you how to get started with the PureScript programming language, from the basics (setting up a development environment) to the advanced.

Each chapter will be motivated by a particular problem, and in the course of solving that problem, new functional programming tools and techniques will be introduced. Here are some examples of problems that will be solved in this book:

  • Transforming data structures with maps and folds
  • Form field validation using applicative functors
  • Testing code with QuickCheck
  • Using the canvas
  • Domain specific language implementation
  • Working with the DOM
  • JavaScript interoperability
  • Parallel asynchronous execution

License

Copyright (c) 2014-2017 Phil Freeman.

The text of this book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License: https://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US.

Some text is derived from the PureScript Documentation Repo, which uses the same license, and is copyright various contributors.

The exercises are licensed under the MIT license.