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 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.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.
Ansible for KubernetesJeff Geerling
Ansible is a powerful infrastructure automation tool. Kubernetes is a powerful application deployment platform. Learn how to use these tools to automate massively-scalable, highly-available infrastructure.
Functional Design and ArchitectureAlexander Granin
Software Design in Functional Programming, Design Patterns and Practices, Methodologies and Application Architectures. How to build real software in Haskell with less efforts and low risks. The first complete source of knowledge.
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.
Tame your Work FlowSteve Tendon and Daniel Doiron
Do you need a high performance enterprise governance approach improving management, execution and delivery while dealing with multiple projects/products, events, stakeholders and teams? Giving you better bottom line results, faster time to market, less work, better predictability, happier employees, and delighted clients? Then learn about TameFlow!
Practical FP in Scala: A hands-on approachGabriel Volpe
A practical book aimed for those familiar with functional programming in Scala who are yet not confident about architecting an application from scratch.
Together, we will develop a purely functional application using the best libraries in the Cats ecosystem, while learning about design patterns and best practices.
Composing SoftwareEric Elliott
All software design is composition: the act of breaking complex problems down into smaller problems and composing those solutions. Most developers have a limited understanding of compositional techniques. It's time for that to change.
Algebra-Driven DesignSandy Maguire
A how-to field guide on building leak-free abstractions and algebraically designing real-world applications.
Invest In Digital Health - The Medical Futurist's GuideDr. Bertalan Mesko
Artificial Intelligence and Digital Health are booming. In this book, we explain why now it's a good time to invest in Digital Health and give recommendations on where to invest by looking at the top 24 technological trends we find the most promising.
The Hundred-Page Machine Learning BookAndriy Burkov
Everything you really need to know in Machine Learning in a hundred pages.
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
Marionette.js A to Z
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...
General Systems Thinker Bundle
5 BooksThe General Systems Thinker Bundle is just that: a bundle of five books to advance the reader one giant step toward improved thinking, based on General Systems principles. Four of the books are the complete General Systems Series. The fifth is fictional piece which shows some general systems thinkers in action. It's a mystery in which a group of...
Experiential Learning Bundle
4 BooksThis bundle provides all four volumes of the popular Experiential Learning Series at a savings of $20 over the price if purchased separately.
2 BooksAfter getting up and running with Ansible in Jeff Geerling's Ansible for DevOps, strengthen your skills managing tens to thousands of instances and services in Amazon's AWS cloud with Yan Kurniawan's Ansible for AWS.
Learn ECMAScript 6 inside and out
2 BooksFor any technology, it helps to get multiple points of view on the functionality to get the best possible understanding. For ECMAScript 6/2015, no two resources are recommended more frequently thanExploring ES6by Dr. Axel Rauschmayer andUnderstanding ECMAScript 6by Nicholas C. Zakas. These two points of view, investigating the specification and...
NetBeans Platform Starter Kit
2 BooksIn this bundle, you get a complete introduction to the NetBeans Platform APIs, together with many exercises, in the form of "NetBeans Platform for Beginners". This book is done and has been reviewed and is over 350 pages in length. It will continue to grow as more content is added over time. There will be monthly updates, with new sections,...