Applicative lesson 10, homomorphism and composition, is now available. As I mentioned yesterday, these lessons have taken a lot of work to organize. The turning point for me, what made everything fall together into a coherent story, is realizing that we can view homomorphism as the central concept for all four laws.
I am very pleased to announce the release of lesson 9 of the Applicative series. In this lesson, we write property tests for the Applicative laws using Hedgehog. This episode includes a refresher on how to combine Hedgehog generators, and along the way we get to see some fun stuff like ambiguous type signatures and rank-N types. We write properties for three of the four laws, leaving the interchange property as an exercise. At the end of the lesson, we have a Hedgehog property group that we will use in the next two lessons to give a thorough discussion of what the laws mean and examples of what it means to break them.
The Alternative typeclass is the last episode in our series on monoids.
Another function we love: toIntegralSized, a safe way to convert between all the various types of whole numbers.
As our latest Joy of Haskell monograph, Sockets and Pipes, is nearing completion, we have released the coupon that enables all Typeclasses members to download the book for free.
We’ve added a search page to help you find what you’re looking for on Type Classes. It uses the …
Last month we quietly released the Tweet history project, a series about reading CSV files in which we rewrite a program …
A disturbing perspective pervades the practice of programming. “Everybody writes garbage code.”
I was having trouble running
cabal updateon my machine and, having figured out a solution using Nix, thought I should write the solution down.
Here we show you some boring Haskell, a shell script to generate some files we need to build a project.
We now offer a free introduction to Haskell crash course with video and full transcriptions available for each lesson. We have presented this course twice at ZuriHac and decided to make it permanently accessible here on our web site.
In this lesson we look at why an important data structure called Map is not a valid instance of Applicative. We…
This series gives a comprehensive introduction to basic GHCi commands and usage.
This series begins with an introduction to GHC extensions, what they are and how to use them. That page is connected to a series …
We’ve expanded the partial type signatures lesson. It discusses what kinds of things can be inferred with the extension, …
After a brief look at
IOas an applicative functor, we explore what it means that functors compose, paying special attention to the …
The :main command in GHCi runs your program’s
mainaction. But did you know that you can also pass it command-line …
Folding: A common task, and a common first step on the road to thinking functionally! Thanks to Jesus E. …
While Chris has previously written about the ways in which Stack and Nix are competing tools, we’ve found ourselves a few times using Stack and Nix, together. …
A monitoring server demonstrates using queues to communicate between threads, and using sockets to communicate between …
The Applicative series continues its study of the notion of applicative functors as contexts for …
A lot of software has to deal with time in some form or another. Moments in time covers basic parsing and …
We’ve been giving a lot of thought lately to how to present some of the more exotic language …
We’ve added two new lessons to the the Validation course, thus making all of the book’s content available to Type Classes members. One lesson is about using
coercesafely and effectively for
newtype-heavy code, while the other is an introduction to the
lenslibrary through the prisms in the
We have decided to open the Haskell Phrasebook to community contributions. We especially encourage contributions from people who have never contributed to a Haskell project before but would like to.
Often we find ourselves needing a pair of related functions: 1. to encode some simple sum type as a …
In Haskell, all types are known statically at compile time. Or are they? We don’t use
Dynamic, but …
Functortown is back with a lesson on the rest of the
Applicativeclass, the two “bird operators,”
(*>). Through three examples, we explore the sequencing…
Today we add five new pages to the series on iterators, bringing the total up to 11 pages and …
The standard library for GHC Haskell includes at least four functions that perform a basic function …
We are excited to announce The Haskell Phrasebook. Taking an approach similar to Go by Example, it emphasizes how to get started writing programs quickly. In a departure from our usual style, this project does not explain everything in full detail; the Phrasebook’s role is only to be a traveler’s starting point and quick reference.
We’re writing the Python course in a slightly different style from most of Type Classes, because it is aimed at a more focused audience. The idea is that if you are already familiar with Python, then we want to leverage as much of your existing Python knowledge as possible as you learn Haskell. For example, we’re not including quite as many type signatures in our explanations as we normally would, and we defer the introduction of some aspects of Haskell to minimize the amount of patience required if you just want to answers to questions of the form ‘I know how to do this thing in Python; how do I do it in Haskell?’ This post is about one particular small choice regarding range syntax.
The latest Python lesson is all about zipping, a notion also sometimes referred to as aligning. We discuss three Python functions:
Type Classes has been in business for a year. To celebrate and share our success, annual memberships are half-off through June 30.
Quick site design update: We’ve added navigation buttons at the top of pages that are part of a series.
A monoid is a type along with a binary associative operation and an identity element. We’ve written a …
We added documentation for the newtypes in the
Data.Semigroupmodule, and with that the semigroup page is …
To concatenate two Python iterators, we use
chain. The corresponding Haskell function is
The latest lesson in the Python course is about functions that produce simple never-ending iterators. The ability to represent concepts like “counting upward from one” and “repeating an item ”…
We previously discussed in the iterators lesson how Python iterators relate to Haskell lists. If you’re …
We just started a new section of the site called “Featured functions” which will house quick overviews of functions that we think deserve some extra love and attention. The first two featured functions are mapMaybe and intercalate. Web Servers lesson 12 is about connection persistence – reusing the same socket for multiple HTTP requests. We write two versions of the server, one using lazy I/O and the other using strict
We have new lessons in two of our ongoing courses. In the fourth installment of the Timepieces course, Julie examines how the hierarchy of
fltkhsis meant to mirror that of FLTK. The latest lesson in the Web Servers course is about parsing message bodies. And we’ve added to our documentation of GHC language extensions with an article on
This week we’re excited to bring you a new lesson in the native GUI course. In this lesson, Chris uses gtk3, Pango, and TVars to transform the blank application window into a clock. And the latest lesson in the Functortown course, in which Julie introduces the laws of the Bifunctor class and goes into more detail about how ranges and shrinkage work when you’re property testing with hedgehog.
Everyone who has an active Type Classes subscription as of today can get the book for free on Leanpub; check your account page under the section entitled “Leanpub coupons”. The link can be used twice, so you can give a copy to a Haskell-curious friend.
We’ve released Web Servers lesson 9, Parsing requests, which continues our study of HTTP and gives a practical introduction to Attoparsec. We also continue to show how to ask GHCi for help with guides for using the beloved typed holes feature, all the uses of underscores, and warnings related to unused values.
This week we made some billing changes: There’s now an annual billing option in addition to monthly, and we now offer region-based discounts. We also took some time to publish a lot of the code that we use to work the Stripe API. You can find the code in the typeclasses/stripe repository on GitHub.
Our first Template Haskell article focuses on one narrow use case: Compile-time evaluation of constant expressions. Because we care dearly about avoiding sources of runtime errors wherever possible.
Julie presented a workshop on maximizing the useful information you can get from GHCi. It wasn’t recorded, but we’re working on getting all that information onto the site for our subscribers.
Check out our new Haskell tip, entitled Strict, lazy, and builder – It covers the various string types in the
Julie gave the keynote at C∘mp∘se :: Melbourne and we launched our new career as Haskell pamphleteers!
We’ve started releasing the web servers course, which will explain a lot about HTTP and how to write network applications in Haskell.
I chose the “Validation” course to be our flagship course on Type Classes because it’s material I’ve tested with meetup groups. Taking the same starting point as one of my more popular blog posts, it successively refactors relatively simple code until we’ve learned about several of Haskell’s most important features.
We’ve added additional video formats, so videos should now be working on most devices. This post includes some details on how the HTML
<video>tag supports multiple formats and how we generate DASH and HLS encoded versions of our videos.
Haskell Summer School has wrapped up, and we are back to work. Recordings of our classes are available.
“A monoid is a pipeline of functions”? Be careful not to get lost in a particular example for a typeclass.
Since our initial Type Classes announcement, we’ve been asked a number of questions about payments and planned content. Find out what’s available now, when we’ll start taking payments, and what you can expect as a subscriber.
On February 24, 1988, Philip Wadler introduced the idea of type “classes” for Haskell, as a solution to the problem of overloading. Thirty years later, we present Type Classes: a series of focused video courses on Haskell, Nix, and related subjects.