Succeeding in Industry with Haskell
About the Book
So you've learned Haskell. You've taught your friends about monads, you've worked through some beginner textbooks, and maybe you've played around with some open source projects. Now that you've had a taste, you want more: you want to write an application in Haskell for fun! Maybe you want to use Haskell at work!
You sit down at your computer, and you're stuck.
How does anyone actually get anything done with this language?
This is a common thing to wonder.
Haskell has always enjoyed a wide variety of high quality learning material for advanced parts of the language, if you're not afraid of academic papers. The last five years have seen an upswelling of fantastic resources for learning the language as a beginner. However, the language does not have many resources for using it in production. It's difficult to navigate the ecosystems and identify quality resources that are in alignment with your goals and values.
This book aims to help with that situation. After reading this book, you should feel comfortable writing large software projects in Haskell, evaluating competing libraries and techniques, and productively reading material from a variety of Haskell users.
An Opinionated Tour Guide
Haskell is a hugely diverse landscape.
There are many regional groups: United Kingdom, Scandinavia, mainland Europe, Russia, the USA, Japan, China, and India all have thriving Haskell ecosystems that have interesting dialects and differences in custom and practice.
People come to Haskell with many backgrounds. Some people learned Haskell well into their careers, and had a long career writing Java, Scala, or C# beforehand. Some people came to Haskell from dynamically typed languages, like LISP or Ruby. Some people started learning Haskell very early on in their programming career, and use it as the basis of comparison. Some people primarily use Haskell in academic research, while others primarily use Haskell in industrial applications. Some people are hobbyists and just like to write Haskell for fun!
This book is intended for people that want to write Haskell in industry. The tradeoffs and constraints that industrial programmers face are different from academic or hobbyist programmers. This book will cover not only technical aspects of the Haskell language, but also social and engineering concerns that aren't "really" about Haskell.
Part of this book will be objective. I will teach you how to use some interesting techniques and ideas to make developing with Haskell more productive. We'll learn about Template Haskell, type-level programming, and other fun topics.
However, for the most part, this book is inherently subjective. Because Haskell serves so many ecosystems, it is imperative to discern what ecosystem a something is intended for. More than just giving out prescriptions - "This library is production ready! This is a toy!" - I hope to show my thought process and allow you to make your own judgment calls.
Ultimately, this is a book about the social reality of software engineering in niche languages.
About the Author
My brain picked up Haskell extremely quickly. I had barely started learning imperative and object-oriented programming, so the difficult novelty of learning new jargon and concepts was expected. In August 2015, I started a Haskell internship, and I was able to use Haskell in my Artificial Intelligence coursework. In my last semester of college, I was able to use Haskell in my undergraduate thesis to study the connection between category theory, modal logic, and distributed systems.
I was extremely fortunate to have these opportunities, as they set me up for success to work with Haskell. My first job out of college was converting PHP applications to greenfield Haskell, and I've been working full-time with Haskell ever since. I've worked in a variety of contexts: a startup that wasn't 100% sold on Haskell, a larger company that was sold on Haskell but wrestling with social and technical difficulties of a huge code base and development team, and a startup that was sold on Haskell and working on growing. I also contribute to many open source projects, and I'm familiar with most of the ecosystems. All told, I have worked with nearly a million lines of Haskell code!
I've seen Haskell fail, and I've seen it succeed. I'd like to help you succeed with Haskell.
- An Opinionated Tour Guide
- About the Author
I Building Haskell Teams
1. Selling Haskell
- 1.1 Assessing Receptiveness
- 1.2 Software Productivity
- 1.3 Statistics of Productivity
- 1.4 Know Your Competition
2. Learning and Teaching Haskell
- 2.1 The Philology of Haskell
- 2.2 Programming Isn’t Easy To Learn
- 2.3 Pick Learning Materials
- 2.4 Write Lots of Code
- 2.5 Don’t Fear the GHC
- 2.6 Start Simple
- 2.7 Solve Real Problems
- 2.8 Pair Programming
- 2.9 A Dialogue
- 2.10 References
3. Hiring Haskellers
- 3.1 The Double Edged Sword
- 3.2 Juniors and Seniors
- 3.3 Hiring Seniors
- 3.4 Hiring Juniors
4. Evaluating Consultancies
- 4.1 Identifying the Target
- 4.2 Well-Typed
- 4.3 FP Complete
- 1. Selling Haskell
II Application Structure
5. The Beginning
- 5.1 Abstraction for Mocking
- 5.2 Forward Compatibility
- 5.5 Embed, don’t Stack
6. Three Layer Haskell Cake
- 6.1 Layer 1: Imperative Programming
- 6.2 Layer 2: Object Oriented Programming
- 6.3 Layer 3: Functional Programming
- 6.4 Examples
7. Invert Your Mocks!
- 7.1 Decomposing Effects
- 7.2 Streaming Decomposition
- 7.3 Plain ol’ abstraction
- 7.4 Decompose!!!
- 7.5 What if I need to?
8. Project Preludes
- 8.1 Prelude Problems
- 8.2 Custom Benefits
- 8.3 Off-The-Shelf Preludes
- 8.4 Nesting Preludes
- 8.5 Downsides
- 8.6 Using a Custom Prelude
9. Optimizing GHC Compile Times
- 9.2 Package Splitting
- 9.3 Big Ol Instances Module
- 9.4 Some random parting thoughts
- 9.5 Results
- 9.1 The
- 5. The Beginning
III Domain Modeling
10. Type Safety Back and Forth
- 10.1 The Ripple Effect
- 10.2 Ask Only What You Need
11. Keep Your Types Small…
- 11.1 Expansion and Restriction
- 11.2 Constraints Liberate
- 11.3 Restrict the Range
- 11.4 A perfect fit
12. The Trouble with Typed Errors
- 12.1 Monolithic error types are bad
- 12.2 Boilerplate be gone!
- 12.3 Type Classes To The Rescue!
- 13.1 Exceptions In Five Minutes
- 13.2 Best Practices
- 13.3 Hierarchies
- 13.4 Reinventing
- 13.5 Asynchronous Exceptions
- 13.6 The Theory
- 13.7 HasCallStack
14. EDSL Design
14.1 Tricks with
- 14.2 Overloaded Literals
- 14.3 Type Inference Trick
- 14.4 Fluent Interfaces
- 14.5 Case Study: Weightlifting Logging
14.6 Case Study:
14.7 Case Study:
- 14.1 Tricks with
15. Growing Pains
- 15.1 A Taxonomy of Breaking Changes
- 15.2 Avoiding Breaking Changes
- 15.3 Communicating To Users
- 10. Type Safety Back and Forth
IV Interfacing the Real
- 16.1 Libraries and Tools
- 16.2 Designing Code for Testing
17.1 Case Study:
- 17.1 Case Study:
- 18.1 Logging Contexts
- 18.2 Library Comparison
- 19.1 Access Patterns
- 19.2 Separate Database Types
- 19.3 Library Comparisons
- 20. Profiling
- 16. Testing
V Advanced Haskell
21. Template Haskell Is Not Scary
- 21.1 A Beginner Tutorial
- 21.2 wait this isn’t haskell what am i doing here
- 21.3 Constructing an AST
- 21.4 Boilerplate Be Gone!
22. Basic Type Level Programming
- 22.1 The Basic Types
- 22.2 The Higher Kinds
- 22.3 Dynamically Kinded Programming
- 22.4 Data Kinds
- 22.5 GADTs
- 22.6 Vectors
- 22.7 Type Families
- 22.8 This Sucks
- 22.9 Heterogeneous Lists
- 22.10 Inductive Type Class Instances
- 22.11 Extensible Records
- 22.12 Like what you read?
23. Trade-offs in Type Programming
- 23.1 MPTCs
- 23.2 MPTCs + Fundeps
- 23.3 Associated Types
- 23.4 Comparisons
24. Case Study: Prairie
- 24.1 Problem Statement:
- 24.2 Prior Art
- 24.3 The GADT Approach
- 24.4 Improvements?
- 24.5 Symbols
- 24.6 Compare and Constrast
- 24.7 Identify the Issue
- 24.8 Generalize a GADT
- 24.9 Fundeps
- 24.10 More Class Please
- 24.11 Refining the Class
- 24.12 Template Haskell
- 24.13 Conclusion
- 21. Template Haskell Is Not Scary
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
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), EPUB (for phones and tablets) and MOBI (for 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.
C++ Best PracticesJason Turner
Level up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Continuous Delivery PipelinesDave Farley
This practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
OpenIntro StatisticsDavid Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntro
A complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
C++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
The book is almost daily updated. These incremental updates ease my interaction with the proofreaders.
Atomic KotlinBruce Eckel and Svetlana Isakova
For both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Introductory Statistics with Randomization and SimulationMine Cetinkaya-Rundel, Christopher Barr, OpenIntro, and David Diez
A complete foundation for Statistics, also serving as a foundation for Data Science, that introduces inference using randomization and simulation while covering traditional methods.
Leanpub revenue supports OpenIntro, so we can provide free desk copies to teachers interested in using our books in the classroom.
More resources: openintro.org.
Ansible for DevOpsJeff Geerling
Ansible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Java OOP Done RightAlan Mellor
Object Oriented Programming is still a great way to create clean, maintainable code. But only if you use it right.
This book gives you 25 years of OO best practice, ready to use.
You'll learn to design objects behaviour-first, use TDD to help, then confidently apply Design Patterns, SOLID principles and Refactoring to make clean, crafted code.
Introducing EventStormingAlberto Brandolini
The deepest tutorial and explanation about EventStorming, straight from the inventor.
Discrete Mathematics for Computer ScienceAlexander Shen, Alexander S. Kulikov, Vladimir Podolskii, and Aleksandr Golovnev
This book supplements the DM for CS Specialization at Coursera and contains many interactive puzzles, autograded quizzes, and code snippets. They are intended to help you to discover important ideas in discrete mathematics on your own. By purchasing the book, you will get all updates of the book free of charge when they are released.
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before...
CCIE Service Provider Ultimate Study Bundle
2 BooksPiotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification...
Cisco CCNA 200-301 Complet
4 BooksCe lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301.
Modern C++ by Nicolai Josuttis
CCDE Practical Studies (All labs)
3 BooksCCDE lab
"The C++ Standard Library" and "Concurrency with Modern C++"
2 BooksGet my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library...
2 BooksDocker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes!
The Future of Digital Health
6 BooksWe put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer...
Django for Beginners/APIs/Professionals
Linux Administration Complet
4 BooksCe lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité...