Haskell in Depth
Vitaly Bragilevsky
  • MEAP began June 2018
  • Publication in Fall 2019 (estimated)
  • ISBN 9781617295409
  • 625 pages (estimated)
  • printed in black & white

A great stepping stone into using and understanding idiomatic Haskell.

Giovanni Ornaghi
Turn the corner from “Haskell student” to “Haskell developer.” Haskell in Depth explores the important language features and programming skills you’ll need to build production-quality software using Haskell. And along the way, you’ll pick up some interesting insights into why Haskell looks and works the way it does. Get ready to go deep!
Table of Contents detailed table of contents

0 Haskell in Depth: How to work with the source code examples

0.1 Getting the sources

0.2 Using Stack

0.2.1 Building

0.2.2 Running

0.2.3 Exploring in GHCi

0.3 Using Cabal sandbox

0.3.1 Building

0.3.2 Running

0.3.3 Exploring in GHCi

0.4 Using Cabal new-*

0.4.1 Building

1 Haskell nowadays

1.1 Language features and programming styles

1.1.1 Functional programming

1.1.2 Type system

1.1.3 Lazy evaluation

1.2 Tooling around Haskell

1.3 What can be done using Haskell: Libraries

1.4 What is in this book

1.5 Summary

Part 1: Core Haskell

2 Functional programming with types and type classes

2.1 Basic text processing in functional style

2.1.1 First attempt: Exploring the problem in a REPL with Strings

2.1.2 Moving away from REPL and Strings

2.1.3 Designing a functional program as a set of IO actions

2.1.4 Embracing pure functions

2.2 Type classes and their instances

2.2.1 Equality and order, enumerating and boundedness

2.2.2 Example: Programming a locator with type classes and instances

2.2.3 Numeric types and type classes

2.2.4 The type classes Show, Read, and beyond

2.2.5 Demystifying the OverloadedStrings GHC extension

2.3 Abstracting computations with type classes

2.3.1 The only operation, (<>)

2.3.2 Mapping, applying, and sequencing in a computational context

2.3.3 Folding and traversing

2.4 Summary

3 Processing stock quote data: An example

3.1 Setting the scene

3.2 Exploring design space

3.2.1 Dealing with dates and times

3.2.2 Computing with fixed precision

3.2.3 Parsing data

3.2.4 Formatting texts

3.2.5 Other tasks and the corresponding packages

3.2.6 External packages in the project

3.3 Implementing stockquotes project

3.3.1 Describing data

3.3.2 Computing statistics

3.3.3 Formatting statistical report

3.3.4 Drawing charts

3.3.5 Designing user interface

3.3.6 Connecting the parts

3.4 Extending project with reports in HTML

3.4.1 Changes in user interface

3.4.2 Generating reports in HTML format with blaze-html

3.4.3 Changes in the Main module

3.5 Summary

Part 2: Developing Projects in Haskell

4 Structuring programs with modules and packages

4.1 Haskell programs as collections of modules

4.1.1 Module structure, imports, and exports

4.1.2 Using custom preludes for encouraging best practices

4.2 Understanding Haskell packaging

4.2.1 Packaging at the compiler level

4.2.2 Cabal packages and Hackage

4.2.3 Versioning packages

4.3 Tools for Haskell project management

4.3.1 Traditional package management with cabal-install

4.3.2 Nix-style local package management with cabal-install

4.3.3 Using stack and Stackage for Haskell development

4.3.4 Continuous integration for Haskell projects

4.4 Summary

5 Monads as practical functionality providers

5.1 A teaser: Maybe monad as a line saver

5.2 Reading and writing

5.2.1 Access to the configuration via Reader

5.2.2 Writing logs via Writer

5.2.3 Running Writer computations

5.3 Maintaining state via State monad

5.3.1 Random numbers in Haskell and State monad

5.3.2 Exploring Rock-Paper-Scissors

5.3.3 Parsing arithmetic expressions with State

5.3.4 RWS monad to rule them all: the game of dices

5.4 Other approaches to mutability

5.4.1 Mutable references in the IO monad

5.4.2 Mutable references in the ST monad

5.5 Summary

6 Structuring programs with monads and monad transformers

7 Error handling

8 Testing and profiling

Part 3: Advanced Haskell

9 Programming polymorphically

10 Type-level programming for type safety

11 Writing Haskell in Haskell

Part 4: Haskell Toolkit

12 Concurrent programming

13 Effective input-output

14 Parsing, serializing, and storing data

15 Featureful datatypes in data processing

16 Implementing web services

Part 5: Haskell at Large

17 Case-study: large applications in Haskell

18 Haskell ecosystem

About the Technology

As software becomes more complex, it’s essential to program efficiently using tools and techniques that guarantee your applications will run correctly, grow easily, and last a long time. Haskell is a functional programming language that blends a mathematically-rigorous approach to software design with a tested ecosystem of tools and libraries you can use to build deployable applications.

About the book

Haskell in Depth is the perfect second book on Haskell. After a quick refresher on Haskell basics, this hands-on guide dives into examples and application scenarios designed to teach how Haskell works and how to apply it correctly. You’ll learn about managing projects with Cabal and Stack, tackle error-handling and testing, and package programs and libraries for production deployment.

You’ll appreciate coverage of advanced Haskell features including programming polymorphically, working effectively with types, concurrent programming, data processing, web services, and more. Because it’s organized to make specific topics easy to find, you’ll return to this book again and again as your go-to Haskell reference.

What's inside

  • Organizing your projects with Cabal and Stack
  • Testing and profiling
  • Working with data
  • Building web services and networking apps
  • Using the sophisticated libraries like lens, vinyl, and servant

About the reader

Written for developers familiar with Haskell basics.

About the author

Since 2008, Vitaly Bragilevsky has been teaching Haskell and functional programming to undergraduate students at the Southern Federal University located in Rostov-on-Don, Russia. He is a member of the Haskell 2020 Committee, and has worked on the source code of the Glasgow Haskell Compiler (GHC) and the Idris compiler, both of which are implemented in Haskell.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.

FREE domestic shipping on three or more pBooks

Perfect for deep diving into Haskell. Great at explaining functional programming.

Artem Pelenitsyn

I especially enjoyed the clear focus in the introduction to highly useful packages which clearly goes beyond just basic material.

Kai Gellien