Leanpub Header

Skip to main content

Modern Haskell Tooling

GHC, Cabal, HLS, and Effect Systems for Professional Development

Modern Haskell Tooling
This book is 100% completeLast updated on 2026-09-23

Take a practical deep dive into modern Haskell development with GHC, Cabal, HLS and effect systems. Learn how the tools work under the hood, how they fit together and how to use them effectively in real production projects. Built for engineers who want to move beyond syntax and develop Haskell with confidence.

Minimum price

$25.00

$35.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
227
Pages
About

About

About the Book

This book is a comprehensive technical reference and practical engineering guide to the modern Haskell ecosystem. It covers the GHC compiler, Cabal build system, Haskell Language Server, and modern effect-system techniques at a depth suitable for professional software engineers building production systems. Through progressively evolving real-world projects, systematic explanations of underlying mechanisms, and rigorous comparison of alternative approaches, you will learn not only how to use these tools but why they work the way they do and how to choose the right architecture for your situation.

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. Throughout his career, he has designed, secured, analyzed and tested complex software and infrastructure, with a particular focus on understanding how systems fail and how they can be made more secure.

Outside of work, Steve enjoys sharing knowledge with the technology community. He collaborates with researchers, industry experts and technology professionals to write practical books covering software development, cybersecurity, cloud computing, networking, DevOps, artificial intelligence and enterprise technologies. His books focus on practical learning through clear explanations, real-world examples and hands-on exercises. With more than two decades of industry experience, his goal is to help IT professionals, students and technology enthusiasts build useful skills and stay current in a rapidly changing industry.

We believe readers deserve to know how our books are created. Most of our authors are not native English speakers, so we use AI to help translate, proofread manuscripts, fix grammar, improve sentence structure and make technical explanations easier to read. AI is used as an editing tool only. It does not replace the research, technical knowledge or hands-on experience behind our books. Some of our authors also prefer to remain anonymous for privacy or professional reasons. In those cases, we publish their work under a different name. The author's name may be different, but the quality of the content and our review process remain the same.

Every book is written, reviewed and maintained by experienced technology professionals, with contributions from our private technical community of more than 420 engineers and researchers. We spend far more time validating technical accuracy and keeping our content up to date than generating text. We are always interested in working with experienced professionals who have deep expertise in a particular technology or domain. If you would like to publish a book with us or help review an existing manuscript, we'd love to hear from you. Send us a message describing your area of expertise. We are especially interested in niche technologies, specialized skills and emerging topics that are underrepresented in existing technical literature.

If you look through the contents of our books, you'll see practical examples, detailed explanations and material that is regularly updated. Our goal is to publish books that professionals can actually rely on, not low-effort AI-generated content. If you ever feel that one of our books does not meet that standard, Leanpub offers a 60-day money-back guarantee. Feel free to request a refund if you are not satisfied with your purchase.

Contents

Table of Contents

GHC, Cabal, HLS, and Effect Systems for Professional Development

Introduction

Chapter 1: The Haskell Ecosystem Today

  1. Haskell in Production
  2. The Toolchain at a Glance
  3. Getting Started: Installing GHC and Cabal
  4. A Minimal Working Project
  5. The Development Loop
  6. Summary

Chapter 2: How GHC Compiles Your Code

  1. The Compilation Pipeline
  2. Core: GHC’s Intermediate Language
  3. The STG Machine and Register Allocation
  4. Code Generation and Object Files
  5. The Compilation Graph and Dependencies
  6. GHC Artifact Files: Hi, O, and Beyond
  7. Summary

Chapter 3: GHC’s Type System in Practice

  1. Types, Kinds, and the Kind System
  2. Type Classes: Structure and Resolution
  3. Essential Language Extensions
  4. Advanced Extensions: GADTs, DataKinds, TypeFamilies
  5. Type Error Diagnostics
  6. Type System Pitfalls and Anti-patterns
  7. Summary

Chapter 4: GHC Optimization and Compiler Flags

  1. Optimization Levels: -O, -O1, -O2
  2. Key Optimization Flags
  3. Profiling Flags and Their Interactions
  4. Development vs Production Build Configurations
  5. Inspecting Optimized Code with -ddump-simpl
  6. Optimization Gotchas: Float Invariants, Specialization
  7. Summary

Chapter 5: The GHC Runtime System

  1. The RTS Architecture
  2. Garbage Collection: Generational and Concurrent
  3. Lightweight Threads and the Scheduler
  4. Mutable State: MVars, TVars, STM
  5. RTS Flags and Configuration
  6. Memory Layout and Performance Implications
  7. Summary

Chapter 6: GHCi and Interactive Development

  1. GHCi Basics and Essential Commands
  2. Loading and Reloading Modules
  3. Interactive Debugging with Breakpoints and Stepping
  4. Script Mode and :! Commands
  5. GHCi Configuration and Startup Scripts
  6. Interactive Development Patterns
  7. Summary

Chapter 7: GHC Diagnostics and Warnings

  1. Warning Flags and Categories
  2. Essential Warnings for Production Code
  3. Configuring Warnings in Cabal and GHC Files
  4. Reading GHC Type Errors Systematically
  5. Common Error Patterns and Fixes
  6. Setting Up Your Project for Maximum Diagnostics
  7. Summary

Chapter 8: Cabal Package Management Fundamentals

  1. What a Cabal Package Is
  2. Package Description Format
  3. Dependencies and Version Constraints
  4. The Solver and Dependency Resolution
  5. Package Index and Hackage
  6. Cabal Config and Global Settings
  7. Summary

Chapter 9: Building Projects with Cabal

  1. Components: Libraries, Executables, Tests, Benchmarks
  2. Build Dependencies and Configuration
  3. Cabal Flags and Feature Management
  4. Build Scripts and Custom Setup
  5. Incremental Builds and Caching
  6. Build Output and Generated Files
  7. Summary

Chapter 10: Advanced Cabal: Large Projects and Multi-Package Sets

  1. Multi-Package Projects and Cabal Workspaces
  2. Local Package Dependencies and Path Constraints
  3. Solver Constraints and Pins
  4. Managing Dependencies Across Many Packages
  5. Splitting Large Projects: Library vs Application Boundaries
  6. Real-World Multi-Package Project Structures
  7. Summary

Chapter 11: Reproducible Builds, CI/CD, and Project Hygiene

  1. Reproducible Builds and Freezes
  2. Haskell Stack vs Cabal: When Each Makes Sense
  3. Continuous Integration for Haskell Projects
  4. Cross-Compilation and Platform-Specific Builds
  5. Documentation Generation with Haddock
  6. Keeping Dependencies Updated Safely
  7. Summary

Chapter 12: The Haskell Language Server

  1. What HLS Does and Why It Matters
  2. Installing and Configuring HLS
  3. Diagnostics and Real-Time Error Checking
  4. Code Completion and Navigation
  5. Code Actions and Refactoring
  6. Expression Evaluation and Hover Information
  7. Summary

Chapter 13: Editor Integration and HLS Workflows

  1. VS Code and haskell-vscode
  2. Neovim and HLS Integration
  3. Emacs and HLS Configuration
  4. Shared HLS Settings Across Editors
  5. HLS Performance Tuning for Large Projects
  6. Troubleshooting Common Editor Integration Issues
  7. Summary

Chapter 14: HLS Architecture and Internals

  1. The GHC API and HLS’s Use of It
  2. How HLS Parses and Type-Checks Your Code
  3. Caching and Incremental Processing
  4. The HLS Plugin System
  5. Performance Characteristics and Bottlenecks
  6. Extending HLS with Custom Plugins
  7. Summary

Chapter 15: Purity, Effects, and the IO Monad

  1. Purity and the No-Side-Effects Guarantee
  2. IO as a Computations Type, Not a Tag
  3. The Monad Abstraction
  4. Do Notation and Effect Sequencing
  5. Practical IO Patterns
  6. Summary

Chapter 16: Type Classes and Effect Abstraction

  1. Effect Abstraction via Type Classes
  2. The Hierarchy: Functor, Applicative, Monad
  3. MonadTrans and the Lifting Problem
  4. Common Effect Type Classes
  5. Designing Your Own Effect Classes
  6. When Effect Abstraction Helps and Hurts
  7. Summary

Chapter 17: Monad Transformers and MTL-Style Programming

  1. Monad Transformers: The Idea
  2. Common Transformers: ReaderT, StateT, ExceptT, WriterT
  3. Building Effect Stacks
  4. The MTL Pattern and Type Signatures
  5. ReaderT-Based Architectures for Services
  6. MTL Complexity and Maintenance Costs
  7. Summary

Chapter 18: Capability-Based Effects and Modern Patterns

  1. What Are Capabilities?
  2. Designing Capability-Based APIs
  3. The io-universe-family and Similar Approaches
  4. Testing with Capability-Based Designs
  5. Comparing Capabilities vs MTL
  6. Real-World Capability-Based Systems
  7. Summary

Chapter 19: Algebraic Effects and Freer Approaches

  1. Algebraic Effects: The Concept
  2. Free Monads and Freer Monads
  3. The extensible-effects Library
  4. Polysemy: Design and Trade-offs
  5. The effectful Library and Effect Handlers
  6. Choosing an Effects Library
  7. Summary

Chapter 20: Comparing Effect Systems and Choosing an Approach

  1. Evaluation Criteria for Effect Systems
  2. Direct IO vs Abstracted Effects
  3. MTL vs Capabilities vs Algebraic Effects: Head to Head
  4. Performance Comparison and Benchmarks
  5. Debugging and Observability Trade-offs
  6. Recommendations by Project Type and Size
  7. Summary

Chapter 21: Testing, Property Testing, and Quality Assurance

  1. Testing Philosophy in Haskell
  2. Unit Testing with Hspec
  3. Tasty as a Test Harness
  4. Property-Based Testing with QuickCheck
  5. Hedgehog: The Modern Alternative
  6. Integration Testing with Real Dependencies
  7. Summary

Chapter 22: Profiling, Benchmarking, and Performance Tuning

  1. CPU Profiling with -prof and -auto-all
  2. Reading GHC Profile Output
  3. Memory and Heap Profiling
  4. Runtime Statistics and RTS Reporting
  5. Benchmarking with Criterion
  6. Performance Tuning Strategies
  7. Summary

Chapter 23: Debugging, Observability, and Production Practices

  1. Debugging Strategies in a Pure Language
  2. Logging Architectures for Haskell Services
  3. Tracing and OpenTelemetry Integration
  4. Handling Errors and Failures Gracefully
  5. Production Configuration and Health Checks
  6. Incident Response for Haskell Services
  7. Summary

Chapter 24: Troubleshooting Case Studies

  1. Dependency Resolution Failures
  2. Confusing Type Errors: A Methodical Approach
  3. Compilation Errors from Missing Extensions and Flags
  4. HLS Not Working: Common Causes and Fixes
  5. Slow Compilation: Diagnosis and Remedies
  6. Runtime Crashes and Memory Issues
  7. Summary

Chapter 25: Conclusion: The Future of Haskell Tooling

  1. What Has Changed in the Last Decade
  2. Ongoing Work in GHC
  3. The Cabal and Build System Future
  4. HLS and Developer Experience
  5. Effect Systems: Where the Ecosystem Is Heading
  6. Haskell in the Professional Landscape

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub