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
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 Cargo Culting
- 13.2 Best Practices
- 13.3 Hierarchies
- 13.4 Typeable
- 13.5 Reinventing
- 13.6 Asynchronous Exceptions
- 13.7 The Theory
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 Avoiding Breaking Changes
- 15.2 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. Logging
- 19. Databases
- 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.
Algebra-Driven DesignSandy Maguire
A how-to field guide on building leak-free abstractions and algebraically designing real-world applications.
Production HaskellMatt Parsons
Are you excited about Haskell, but don't know where to begin? Are you thrilled by the technical advantages, but worried about the unknown pitfalls? This book has you covered.
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.
The Hundred-Page Machine Learning BookAndriy Burkov
Everything you really need to know in Machine Learning in a hundred pages.
Machine Learning EngineeringAndriy Burkov
"If you intend to use machine learning to solve business problems at scale, I'm delighted you got your hands on this book."
—Cassie Kozyrkov, Chief Decision Scientist at Google
"Foundational work about the reality of building machine learning models in production."
—Karolis Urbonas, Head of Machine Learning and Science at Amazon
Cloud StrategyGregor Hohpe
While most enterprises are moving to the cloud these days, many initiatives are driven by wishes or promises rather than a sound strategy. Harvested from half a decade of cloud migrations, this book shares frameworks, strategies, and anecdotes for a structured and decision-centric path to cloud success.
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.
CCIE Service Provider Version 4 Written and Lab Exam Comprehensive GuideNicholas Russo
The service provider landscape has changed rapidly over the past several years. Networking vendors are continuing to propose new standards, techniques, and procedures for overcoming new challenges while concurrently reducing costs and delivering new services. Cisco has recently updated the CCIE Service Provider track to reflect these changes; this book represents the author's personal journey in achieving that certification.
CCIE SP v4.1 - WorkbookŁukasz Bromirski, Piotr Jablonski, and Nicholas Russo
Are you striving to prepare to and pass CCIE SP lab exam? Take the opportunity and get this workbook! With the attached initial cfg files you will prepare yourself for the CCIE SP exam as well as learn SP technologies applicable to all kinds of today modern networks! This workbook covers blueprint topics and provides challenging examples.
Sockets and PipesType Classes
Sockets and Pipes is not an introduction to Haskell; it is an introduction to writing software in Haskell. Using a handful of everyday Haskell libraries, this book walks through reading the HTTP specification and implementing it to create a web server.
The Node.js Bundle
3 BooksThis bundle combines three bestselling Leanpub Node.js books into a package that gives you everything you need to get started with developing Node.js applications at an unbeatable price.
The Tester's Library
8 BooksThe Tester's Library consists of eight five-star books that every software tester should read and re-read. As bound books, this collection would cost over $200. Even as e-books, their price would exceed $80, but in this bundle, their cost is only $49.99. Here are the books, and why they should be in your library: Perfect Software and Other...
11 BooksIn this bundle, you will find 10 different agile books. They are about different aspects of being agile. - finding a job - doing coding dojo's - Retrospectives - Personal kanban - a non-typical coaching book and even a book that gives you an insight in the lives of some agile people.
WTFlop 6M + HU - Beta Bundle
Fifty Quick Ideas
3 BooksGet all three books for the price of two! Fifty Quick Ideas books are full of practical, real-world techniques that you can use to improve teamwork, build better products and build them in a better way.
Growing Agile: Coach's Guide Series
4 BooksThis bundle provides a collection of training and workshop plans for a variety of agile topics. The series is aimed at agile coaches, trainers and ScrumMasters who often find themselves needing to help teams understand agile concepts. Each book in the series provides the plans, slides, handouts and activity instructions to run a number of...
Marionette.js A to Z
Complete Scala Bundle
3 BooksScala is a general-purpose programming language and it's getting extremely popular these days. Some say that learning Scala could be a challenging task. My experience, however, suggests that this is actually a myth that has very little to do with reality. With the right approach, learning Scala can be easy, fun and rewarding.The first book from...
Build A Better Backbone App
3 BooksThe best way to learn new development skills is through experience, but that takes time you don't have.Get the best of both worlds with this bundle: you'll learn how to produce modern web applications by learning from experienced developers like Derick Bailey and David Sulc. BackboneJS is one of the favorite tools on the web today, but it...